Abstract
To investigate the parameter characteristics of permanent magnet synchronous motor (PMSM) speed sensorless vector control system and capture the noise matrices quickly and accurately in the speed estimation process of the extended Kalman filter for PMSM, The recursive least square method with forgetting factor is proposed to determine the actual parameters of the system, and then a new variable-scale chaotic particle swarm optimization (VCPSO) algorithm is put forward to accurately obtain the system noise matrix and the measurement noise matrix. The simulation results show that noise matrix optimization of extended Kalman filter by employing VCPSO algorithm under actual motor parameters is better than those employing standard PSO or chaotic PSO algorithms with faster speed and higher accuracy.
Keywords
Introduction
Permanent magnet synchronous motor (PMSM) has been extensively used in aerospace, ship, and electric vehicle and other fields because of its advantages of small size, simple structure, reliable operation, and high power torque density. However, in the vector control of PMSM, sensors are needed to collect the speed and rotor position signals of the motor itself. The problem such as sensor installation, measurement accuracy, and error can significantly affect the reliability of the control system. Recently, sensorless technology has attracted a widespread attention.1,2 The general installing of mechanical sensors will increase the cost of the system, the size, and weight, and has more stringent requirements for the environment in which it is used. Sensorless control of PMSM is achieved by detecting the relevant electrical signals in the motor windings and using certain identification algorithm to achieve rotor position and speed estimation. This will undoubtedly greatly reduce the cost of motor control.
One of the crucial problems of the sensorless technology of PMSM is the estimation of the running state of PMSM. 3 Among multiple state estimation methods, the Kalman filter based estimation has increasingly attracted much attention because of its good stability and robustness,4,5 The choice of the covariance matrices (namely Q and R) of the process noise and measure noise is very important for the performance of the EKF. Khadija et al. 4 used the trail-and-error procedure to select the matrices Q and R. Zheng et al. 5 directly presented the values of Q and R, and thought that Q and R can only be obtained by empiric adjustment because the actual noises are unknown.
Mao et al. 6 used linear Kalman filter to estimate the rotor position error of longitudinal vibration of electric wheel system in in-Wheel PMSM driven vehicle, 6 and it did not discuss the choice problem of Q an R. Feng et al. 7 studied the permanent magnet temperature (PMT) estimation of PMSMs, and used Kalman filter to estimate the PMT from the measured speed harmonic. It experimentally set the covariance Q and R (called G and E in this literature) depending on the maximum temperature that the PM can vary and the variation of system output within one sampling time. Verrelli et al. 8 discussed the phase locked loop (PLL)-based third-order steady-state linear Kalman filter (SSLKF) for fault tolerant PMSM, but it did not present the choice method of Q and R.
As the development of the mathematical description of PMSM toward more accurate and higher nonlinear and coupled modeling, The extended Kalman filter (EKF) is increasingly used in the high-precision state estimation of PMSM. More research works of EKF applied in PMSM are as follows. Bolognani et al. 9 used EKF as the nonlinear speed and position observer of PMSM. It presented the effect of the value range of matrix Q on the system convergence. Additionally it replaced the usual trial-and-error method with a straightforward matrices choice. Janiszewski and Muszynski 10 showed how to use an EKF instead of sensors of the mechanical quantities as well as how to adapt the model of the PMSM to the filter procedures and aimed at the real time application in the field-oriented control (FOC) structure of the high-dynamic drive. Xiao and Chen 11 took the stator current and PM flux as state variables, used the EKF method to accurately track flux linkage and realized the torque ripple reduction with the current compensation and EKF Method. However it did not discuss the choice of noise matrices Q and R. Akrad et al. 12 designed a fault-tolerant controller for PMSM drive based on two virtual sensors with one being a two-stage extended Kalman filter and a maximum-likelihood voting algorithm. It also did not mention how to determine Q and R. Benchabane et al. 13 used the EKF for the speed, rotor position, and load torque estimation based on the feedback of an indirect power electronic converter which is controlled by a sliding mode technique. Shi et al. 14 used a self-adaption Kalman observer (SAKO) to observe speed and load torque precisely and timely, and they used a variable gain matrix to estimate and correct the observed position, speed, and load torque to solve the large speed error and time delay problem when PMSM runs at low speeds. It was noted that SAKO calculated the measurement noise in real time by analyzing the position read by DSP, which replaced the traditional determination of Q and R by trials.
The other researches on EKF to be applied in PMSM include: parallel reduced-order EKF for rotor position estimation, 15 rotor speeds and positions as well as load torques estimation for both two parallel-connected two five-phase PMSM drive system, 16 and using EKF to estimate both position and speed, without any mechanical sensor for state feedback optimal control of PMSM. 17 The choice of Q and R are not fully discussed in these three researches.
To summarize, the determination of the measurement covariance matrix and the system covariance matrix of EKF is one of the crucial problems of EKF to be used in PMSM, which affects the estimation precision and finally is closely related the control effect. The above studies either did not discuss the choice of Q and R, or used a trial-and-error approach to determine Q and R. Xu et al. 18 used a close loop optimal (CLO) method to optimize the measurement covariance matrix and the system covariance matrix of EKF, which overcame the difficulty to adjust the parameters of the EKF. And the CLO method is derived from the perspective of the speed step response of the PMSM and determines Q and R according to the overshoot and settling time. Enlightened by this, particle swarm optimization is considered herein to determine matrices Q and R. The recent application of PSO in PMSM is such as dynamic self-learning PSO to be used in the electrical parameters, mechanical parameters, and voltage-source-inverter (VSI) nonlinearity estimation of PMSM. 19 To the best of our knowledge, PSO is still not used in the determination of Q and R.
PSO algorithm, originally put forward by Kennedy and Eberhart, 20 has proved to be an efficient algorithm and been widely used in parameter optimization in continuous system. Meanwhile chaos search has become an effective method to enhance the local search ability. Therefore, in this paper, particle swarm optimization and variable scale chaos are combined to optimize the EKF noise matrix for the state estimation of sensorless PMSM system. Since the Kalman filter involves the state equation whose coefficient matrices are made up of the PMSM parameters, the recursive least square (RLS) method with forgetting factor is first used to identify the actual parameters of the motor. Then EKF speed estimation model is established and the variable scale chaotic PSO is proposed to optimize the measurement covariance matrix and the system covariance matrix of EKF. Finally the simulations are completed to verify the robustness and stability in PMSM speed estimation. The above process is shown in a flowchart form in Figure 1.

Diagram of the research frame.
The rest of this paper is organized as follows. Section 2 contains the modeling of PMSM and parameter identification. Section 3 presents the extended Kalman filter algorithm for PMSM. Section 4 discusses the EKF noise matrix determination using the variable scale chaotic particle swarm algorithm. Section 5 presents the numerical simulation. Finally the conclusion is drawn in Section 6.
PMSM modeling and parameter identification
Mathematical model
PMSM is an AC synchronous motor excited by permanent magnets. It is mainly composed of stator and rotor as shown in Figure 2. The stator uses three-phase windings that are symmetrical in space with a position difference of 120°. When a symmetrical three-phase sinusoidal current is applied to the stator, a rotating circular magnetic field will be generated in the air gap of PMSM. According to the principle of minimum reluctance, the magnetic flux is always closed along the path of minimum reluctance, the rotor is pulled to rotate by magnetic attraction, so the permanent magnet rotor will follow the rotating magnetic field generated by the stator to rotate synchronously.

Structure of PMSM: (a) schematic diagram and (b) actual photo.
When PMSM adopts vector control, it can be equivalent to a separately excited DC motor, so the control strategy can be simplified. The mathematical model of PMSM in d-q rotating coordinate system 14 is given as
where,
Parameter identification
Considering that the drastic changes of internal temperature, stator current, and rotor load of PMSM will lead to great changes of motor parameters, it is necessary to identify the motor parameters accurately in order to achieve accurate control. Generally, the real-time performance of motor parameter identification is greatly affected by the convergence rate of the identification algorithm. Therefore, RLS algorithm with forgetting factor with faster convergence rate can be selected. 15
The expression of the recursive least squares estimator with forgetting factor is as follows:
where
According to the above principle and in combination with equation (1), the variables
Therefore, from equation (3) it can be seen that the input matrix
The convergence of the above parameter identification is analyzed as follows. When
If
Extended Kalman filter algorithm for PMSM
For the filtering problem of nonlinear system, the commonly used method is linearization technique by converting it into an approximate linear problem, and the most widely used method is extended Kalman filter (EKF). EKF is evolved on the basis of linear Kalman filter. It mainly uses the local characteristics of nonlinear functions to localize the nonlinear model, and gets the model which is similar to the linearization model. Then, Kalman filter algorithm is used to achieve the optimal estimation of the target state. 17 In this paper, the rotor position and speed of PMSM are observed by EKF. In order to avoid the nonlinearity and decrease the calculation time of EKF, the mathematical model can be established from d to q rotating coordinate system to static coordinate system. The voltage equation is as follows:
Where
Transforming equation (6) into the current equation results in
Therefore the state variables are selected according to the motor equation, and the stator input voltage
where
Based on Taylor expanding, the Jacobi matrix of
where
Meanwhile, the system transition can be solved as
Considering comprehensively equations (8) to (10), and based on forward Euler formula, the continuous system can be discretized to the following discrete system state equations:
where
where
The PMSM system is transformed into a linear discrete system through the above transformation. Based on this system, EKF algorithm is used for state tracking. The state estimation of EKF for the PMSM system is mainly divided into two stages: prediction and correction. The graphical expressing of the prediction and update processes is shown in Figure 3.
(1) State prediction. According to the optimal estimated state and input of the
where Q is the system noise covariance matrix.

Prediction and update.
The Kalman filter gain is
where R is system measurement noise matrix.
(2) State correction. The predicted state and state estimation error covariance of the system are corrected according to the actual measurement value of the system:
The EKF algorithm is actually a dynamic process of continuous prediction and correction. In this process, one of the main problems of using EKF to estimate the speed and angle of PMSM is how to obtain the accurate noise matrices of EKF. An improved PSO algorithm based on variable scale chaos is used to solve this problem in the next section.
EKF noise matrices determination by VCPSO
Overview of PSO
Particle swarm optimization (PSO) is a heuristic search technology based on swarm intelligence. It is derived from the study of the behavior of birds prey. The basic idea of particle swarm optimization algorithm is to find the optimal solution through the cooperation and information sharing among individuals in the swarm. The PSO algorithm simulates birds in the bird swarm by designing a swarm of mass-free particle. Each particle dimension searches for space species movement. In each particle, there are only two attributes: speed
Where,
Local search based on variable scale chaos
For the standard particle swarm optimization algorithm, it is easy to operate, does not need to adjust too many parameters, and is easy to implement. However, the diversity of the swarm is poor, the evolution speed is slow, and the stagnation phenomenon is apt to appear. In the application process, the algorithm often falls into the local optimum and a premature convergence occurs. Therefore, this paper combines the variable-scale chaos optimization (VSCO) method with the standard PSO algorithm to improve the convergence speed and accuracy of particle swarm optimization by fully using the ergodicity and randomness of chaos. When the premature convergence of PSO occurs, local search is carried out around the particles with good fitness to make them find better positions.
The VSCO algorithm is an improved version of chaos optimization (CO) and its main idea is to take CO as its main structure and to continuously decrease the search range with the increase of iterative steps. In order to improve the efficiency of the CO.18–22 The main steps of variable scale chaos based local search are as follows.
(1) The search range of chaotic variables is reduced according to the following rule
where
(2) The initial chaotic variables
where,
(3) The chaotic variable
(4) Let
VCPSO for EKF matrices determination
Based on the classical particle swarm optimization algorithm, when the particle finds the global optimal solution, other particles in the neighborhood will quickly move to the particle. If the particle is a local optimal solution, the algorithm is easy to fall into the local optimal solution. In order to change this situation, the appropriate inertia weight and learning factor are selected to ensure its effectiveness. Besides, a variable scale chaotic particle swarm optimization (VCPSO) is put forward to enhance the global search. The VCPSO method mainly exerted variable scale chaos operations on the top 20% particles with good fitness, so as to obtain better particles, which is conducive to converge to the global optimal solution.
To use VCPSO to determine the system noise matrix and the measurement noised matrix, each particle corresponds to a set of parameters of the noise matrices. The fitness function should also be defined based on the system performance indices. To aim at obtaining a minimal speed error, the objective function is set as
Where,
Finally, the procedure of EKF for speed and position estimation based on VCPSO is as follows:
(1) The parameters of the algorithm are initialized, especially the appropriate inertia weight and learning factor are selected, and the fitness function value of each particle in the swarm is calculated to determine the individual optimal value and global optimal value of the whole swarm.
(2) According to equation (16), the velocity and position of the particle are updated, and the fitness function value of the particle is calculated again to update the individual optimal value and the global optimal value.
(3) The variable scale chaos method is used to execute the local chaos on the top 20% particles with good fitness. After the local chaos search, turns to Step (2), otherwise turns to Step (4).
(4) If the stop condition (number of iterations) is satisfied, the search ends and the result is output. Otherwise, return to Step (2) to continue the search.
Finally, the above procedure are expressed in a flowchart form, as shown in Figure 4.

Flowchart of VCPSO optimizing EKF.
Numerical simulation verification
To verify the performance of the VCPSO algorithm in parameter optimization, a comparison test on optimizing nonlinear muti-modal Rastrigin function is conducted first, Rastigin function is as:
This function has the global optimal value
Function optimization results.

Converge processes of test function under three algorithms.
From Figure 5 it can be seen that VCPSO and CPSO obviously outperform PSO algorithm and further VCPSO has better converging precision than CPSO, which is because of the introducing the variable scale operations to allow a local search with adaptive range adjustment.
In order to further verify the control effect of the above algorithm applied in PMSM sensorless control, the actual parameters of first identified based on the above method of recursive least squares with forgetting factor, and the speed sensorless vector control system of improved EKF based on parameter identification is built as shown Figure 6.

Sensorless speed vector control system of improved EKF based on parameter identification.
It can be seen from Figure 6 that PI controllers are used to create the desired torque and D-axis and Q-axis voltages. These PI controllers all belong to series correction, and each PI controller is equivalent to adding an open-loop pole located at the origin and an open-loop zero located in the left half-plane of S to the system. The new-added pole can improve the system type, eliminate, or reduce steady-state error, and there-fore improve the system’s steady-state performance. The new-added zero is used to reduce the degree of damping of the system, and moderate the adverse effects of the new-added pole on the system stability and dynamic process. As long as the integration time constant is large enough, the adverse effects of PI controller on the system stability can be greatly reduced. Therefore the stability can be guaranteed and meanwhile with enough margin.
The speed sensorless simulation model of improved EKF based on parameter identification is built in simulink environment as shown in Figure 7.

Simulation model of improved EKF with RLS identification.
According to the model in Figure 7, RLS with forgetting factor is firstly used to identify the motor flux, inductance, and resistance in the PMSM drive system model, the forgetting factor is selected, and the PMSM motor calibration parameters shown in Table 2 are selected. Under the rated load of 5 N, the identification curves of motor flux, inductance, and resistance parameters based on RLS with forgetting factor are obtained as shown in Figure 8(a) to (c).
Simulation parameters of PMSM motor.

RLS parameter identification curves: (a) magnet flux chain, (b) inductance and (c) resistance.
Through the analysis of Figure 8, RLS with forgetting factor will be affected when the motor speed changes suddenly, but it can recover well in a very short time, and the motor parameters can be identified. By selecting the steady-state part of identification, the identified parameter values under this condition can be obtained as shown in Table 3. It can be seen from Table 3 that the identification method of RLS with forgetting factor has better dynamic tracking performance and accuracy.
Parameter identification results.
Further based on the parameter values identified by RLS method with forgetting factor, PSO, CPSO, and VCPSO are used to optimize the noise matrices of EKF: They initialized their particle swarms respectively, the parameters of each particle swarm are transferred to EKF sensorless model, and the RMS is calculate as the output performance index of the model. The output RMS value is used as the fitness function index of particle swarm optimization algorithm, and the particle swarm is continuously updated and the process is repeated until the maximum number of iterations is achieved. All the optimized results are output. Among them, in order to reduce the connection trouble between each module, the numerical transfer between each module of the simulation model is carried out through the global variables. In order to facilitate comparison, the three particle swarm optimization algorithms all use the average value of RLS with forgetting factor in Table 3 as the motor parameters, and set the number of particles per generation, the number of iterations, the inertia weight value, the learning factor, and the maximum chaotic search times to be same. By running the simulation model in Figure 7, the variable values of the three optimization algorithms can be calculated, and the convergence curves of the fitness functions of the three algorithms in Figure 9 can be obtained.

Convergence values of objective function of equation (20).
The optimal values obtained by the three algorithms are shown in Table 4.
Simulation results of the three algorithms optimize EKF.
Using the above result in Table 4, and meanwhile the experimental conditions are selected as follows: the rated load of the motor is 5 N, from static start to 1000 r/min, and then the load is increased from 5 N to 8 N in 0.5 s. Running the operation simulation model, the speed response curve is obtained as shown in Figure 10, the given speed and actual error response curve is shown in Figure 11 and the steady-state performance error comparative analysis of different EKF can be obtained as shown in Table 5. The statistics comparison on RSME index 22 is also completed and listed in Table 5.

Speed response curves.

Response curves of given speed and actual error.
Steady static error comparison of EKF with different method.
According to the comparative curves of Figures 10 and 11, and compared with PSO and CPSO, VCPSO can better optimize EKF noise matrix of EKF sensorless vector control system of permanent magnet synchronous motor with EKF having better tracking performance, smaller steady-state error and much lower torque ripple at startup. Meanwhile, the relatively improving extent is also analyzed in Table 5. The range of speed error in the steady-state operation of EKF sensorless vector control system optimized by VCPSO algorithm is controlled at 5.7 r/min, which is much lower than those by the other two optimization algorithms. As for the RSME index, the value of VCPSO is also significantly less than those of the two algorithms, which means that the VCPSO has higher robustness. The operation effect is more stable after optimization and the results of EKF speed estimation of sensorless PMSM based on VCPSO optimizing EKF noise matrix under parameter identification are stable and accurate.
Conclusion
This work presented a method for the purpose of optimizing EKF speed estimation based on VCPSO algorithm under parameter identification. It solved not only the problem that the motor calibration parameters are inconsistent with the actual operating parameters, but also the problem that it is difficult to quickly and accurately obtain the noise matrix estimation which affects the performance of EKF speed filtering. VCPSO is used to optimize the system noise matrix and measurement noise matrix of extended Kalman filter, and the simulation research is carried out in the vector control system of PMSM without speed sensor.
Through the simulation comparison and analysis, The following conclusions is definitely drawn: the motor parameters based on parameter identification are selected as the simulation model parameters to make the simulation system more accurate and close to the actual state; The VCPSO algorithm can find the better noise matrix values faster and more accurately under identified parameters, and the algorithm is proved to be robust and stable under different working conditions; The proposed method provides a reference for the development of intelligent algorithm based on the motor drive board.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the Key Research and Development Projects of Heilongjiang Province (Grant No. JD22A014 and GA21D004) and the Major Science and Technology Projects of Heilongjiang Province (Grant No. 2021ZX04A01) and the Fundamental Research Funds for the Central Universities (Grant No. 2572020BG01).
