An Adaptive Neural Network Controller Based on PSO and Gradient Descent Method for PMSM Speed Drive

ABSTRACT


INTRODUCTION
In recent years, mechanisms driven by a permanent magnet synchronous motor (PMSM) have been widely used thanks to its advantageous merits of performances, cost and reliability. However, by reason of the continuous variation of parameters, the nonlinearity of system and the inaccessibility of some states and output for measurements, improving the PMSM performances control may become challenging [1][2][3][4][5]. To surpass the above problems, many artificial intelligence techniques have been proposed. Neural network (NN), due to its simple conception and easy implementation, has been widely used in industrial drive applications of PMSM [6,7]. Recently, to improve the control precision, Chao et al. proposed a new strategy of speed control for PMSM where a combination of adaptive back propagation neural network (BPNN) and PID was adopted [8]. The convergence of the proposed control scheme was proved using the Lyapunov Stability Analysis. In order to improve the robustness performance of a PMSM control, an enhanced robust fractional order proportional-plus-integral (ERFOPI) controller is presented [9]. The proposed control law is acted on a fractional order implement function (FOIF) of tracking error. Firstly, to get the parameters of the proposed controller, different tuning rules were adopted to generate the ERFOPI parameters. Secondly, to take changes of the process parameters into consideration NN was used to adjust the controller parameters. Vikas et al. in [10] proposed a NN based PID (NNPID) like controller which is tuned when the controller is operating in an on line mode for high performance PMSM position control. In the first hand, the gains of the NNPID are initialized according to a new training algorithm based on the least square solution. Then, a sequential training algorithm is used to adjust on line the controller parameters. By estimating disturbances, Reference [11] shows a simple method of improving control performance for the speed of PMSM. 1413 introduced a controller builded by proportional feedback controller and feedforward compensation based on a radial basis function network disturbance observer. The proposed controller has shown good properties in disturbance rejection and in parameter variations. In order to meet higher performance specifications for a PMSM, an adaptive modified recurrent Legendre neural network control system is proposed in [12]. It consists of a modified recurrent Legendre NN control with adaptation law and a compensated control with estimation law, derived by using the Lyapunov stability theorem. Despite control methods based on NN have a good robustness against parameter variations and unknown external disturbances, they are confronted by many difficulties. For example, NN parameters training is time-consuming and easily falls into local minimum which making them entirely dependent on initial weights [13]. PSO algorithm, as a newglobe optimization algorithm, has the ability to overcome these problems by accelerating the rate of convergence and preventing weights trapping into local optima. Recently, various controller design methods based on PSO and artificial neural network (ANN) have been developed [14][15][16]. As a new training method for feedforward neural networks (FNNs), an hybrid of PSO and Gravitational Search Algorithm (GSA) is proposed in [17]. It was employed to reduce the problems of trapping in local minima and to accelerate the convergence rate of the learning algorithms. In [18], Yaghini et al. have combined the ability of metaheuristics and greedy gradient based algorithms to obtain a hybrid improved opposition based PSO and a BP algorithm with the momentum term. Effectiveness of the proposed method is compared with several other famous ANN training algorithms on the various benchmark problems.
The purpose of this study is to develop an adaptive NN controller to improve PMSM speed control. In one hand, in order to avoid tapping in local minimum and reducing the training time, PSO algorithm is adopted for selecting the optimal solution of initial weights of the neural network controller (NNC). Then, to adapt the initially uncertain and varying parameters in the control system, the gradient descent method is used to optimize the weights where the convergence of the NN controller is guaranteed from Lyapunov theorem.
This paper is organized as follows. The PMSM model is described in section 2. Section 3 presents the NN speed controller parameters tuning using PSO algorithm and gradient descent method. In section 4, the stability analysis method is developed. The simulation results are presented in Section 5 and the conclusion is presented in Section 6.

BASIC PMSM MODEL
The machine model of a PMSM can be described in the rotor rotating reference frame as follows [19]: where Vd and Vq are d-q axis stator voltages, Id and Iq are d-q axis stator currents, Ld and Lq are d-q axis stator inductances, r  is the electrical rotor speed and  is the flux linkage. The electric torque can be expressed as: (2) and the equation of the motor dynamics is: J is moment of inertia. Te, TL are electromagnetic and load torques. f is friction coefficient. p is number of pole pairs. Assume that Ld =Lq in a non-salient pole machine (surface mounted) PMSM, the model will be even simpler as indicated by the following equations [20]: According to the system of equations (4), the speed control is achieved by controlling the current of two axes (Id and Iq). The machine, speed feedback, speed and current controllers, and inverter constitute the PMSM drive system as shown in Figure 1.

CONTROL STRATEGY 3.1. Adaptive NN Speed Controller
The proposed speed controller for the PMSM is built based on an adaptive NN. In order to avoid trapping in a local minimum and accelerate training convergence, PSO algorithm is adopted firstly to select initial weights. The goal of PSO algorithm is to get the optimal set of weigths (particles' position) by adjusting the trajectories of the particle based on the best positions. Then, to achieve high-performance speed tracking despite of the existence varying parameters in the control system, gradient descent method is used to adjust the network parameters.
The proposed method for determination the NN speed controller parameters comprises the following steps.
Step 1: Input the object value of controlled system into the controller.
Step 2: Search optimal NN speed controller parameters by PSO algorithm.
Step 3: Use the obtained controller to control the PMSM.
Step 4: Feedback the output of the PMSM.
Step 5: Adjust parameters of NN speed controller by the gradient descent method.
Step 6: If the speed error is small enough, then stop else go to Step 4.

PSO for feedforward NN training
The training system of the NN speed controller is determined as described in Figure 2. In this structure, the NN speed controller precedes the PMSM model and receives as input the system reference with the past system outputs and past inputs. The error signal, the difference between the reference signal and the system output, will be used by PSO algorithm to train the network. The training process of NN is usually complicated and high dimensional. The PSO as an evolutionary algorithm could be used in neural network training [22]. It is a population (swarm) based optimization tool. Every single solution (called a particle) "flies" over the solution space in search for the optimal solution. In each generation, each particle is updated based on 2 special particles: Pb is the personal best solution of each particle, and Pg is the global best solution by any particle in the swarm (population). The performance of each particle is measured using a fitness function that varies depending on the optimization problem [23,24]. These particles velocity and position are updated through the following equations: Where, D is the dimension for a searching space, Xi=(xi1,xi2,…,xiD) represents the position of each particle, Vi=(vi1,vi2,…,viD) is the velocity of the th particle, Pib=(pi1,pi2,…,piD) is the best position encountered by th particle , Pg shows the best position found by any member in the entire swarm population Pg=(pg1,pg2,…,pgD), k is iteration counter; C1, C2 are acceleration coefficients and 1, 2 are two similar random numbers in [0, 1].
w is called the inertia factor. It reduces during a run from 1 to near 0 in each generation which facilitates a balance in the exploration and exploitation of the search space, it is determined as follows: where itermax is the maximum number of iterations, and iter is the current number of iteration.

PSOBP Algorithm
In this study, PSO is used to train a NN to obtain an optimum network model and to improve the performance of the NN. During the training phase, the mean squared error (MSE) is used to calculate the fitness value.
where ei is the error between desired and obtained outputs after presenting the ith datum to the network, and N is the number of data in the training dataset.
The procedure of the PSOBP can be described as follows where a particles' position represents the values for the networks' weights and biases. Step3: Change the velocity of the particle according to (5) and update particle position by adding the calculated velocity value to the current position value according to (6).
Step 4: Compare the current value of the MSE with the particals' previous best value (Pib). If the current fitness value is less, then updating Pib.
Step 5: Finding the current global minimum of MSE and compare it with the previous global minimum (Pg). If the current global minimum is better than Pg, then updating Pg.
Step 6: If maximum number of iterations is reached or the fitness values are met, stop the iteration, and the positions of particles are the optimal best solution. Otherwise, the process is repeated from step3.
Step 7: Taking the weights and biases values which optimized by PSO as the initial parameters, the BP network makes autonomous learning.

NN Controller Parameters Adjustment
The NN speed controller weights, optimized by the PSO, will be used to set initial weights in the controller. When the system work situation changes degradation in the control performances can be accrued. To get better control effect and close quickly to control object values, at each control cycle, weights must be adjusted according to the error. The gradient descent method can be used to minimize the system error between the output of the PMSM and the desired output. Objective function is defined as follows: where ω is the actual output and ωref is the desired output. The weights updating is calculated using the gradient method , the expressions (10) and (11) define the formula.
Where  is the learning rate and wij are the weights from the input layer to the hidden layer and wj are the weights from the hidden layer to the output layer.
In each sampling period, to adapt varying parameters in the control system all weights characterized the NN controller are updated according to the errors of closed loop system.
As the hidden and output neuron functions were defined by the logistic sigmoid function, the quantities in (10) and (11) are respectively calculated by the expressions (12) and (13).
Oj is the output of j th neuron in the hidden layer. The change of Lyapunov function is The error difference can be represented as

()
Wk is the networks weight vectors. The expression of () Wk  is given by Based on Equation (17) and Equation (18) we can obtained Substituting the expression of   (22) According to the Lyapunov Theorem [25], the closed loop system is stable if Finally, when we define the matrix norm 2 by 2 max( ) the theorem result is established. The stability condition

SIMULATIONS RESULTS
To verify the effectiveness of the proposed high speed PMSM control algorithm, a digital simulation based on the Matlab/Simulink software package has been carried out. The PMSM characteristics are given in Table 1. The function of PSO in NN speed controller is to get the best set of weights (particles' positions) where several particles are moving to have the best solution. The NN is trained using the training system described in section 3 and Figure 2. In our proposed method, the PSO is adopted to select initial weights. The dimension of each particle is the total number of weights and biases. During the process of weights initiation by PSO, numbers of populations is specified as 21, and iteration number is specified as 100. In the training phase, the setpoint sequence consisting of pulses of random amplitude in the range [0; 300rad/sec], and with a duration of 20 sampling periods. The maximum amplitudes are chosen so as to fully explore the desired speed amplitude range.
To illustrate the advantages of our controller, experiments were executed using two speed controllers such as: the proposed controller and a conventional adaptive NN controller with a random initialization. Figure 3 shows PMSM model response using NNC optimized by PSO for random setpoint. ((dash-dotted) setpoint ωref; (solid) PMSM model response ωm).   Figure 5 shows the stator current q-components. Each change in the speed reference is accompanied by a peak in their shapes. It can be observed that at every changing operating condition the proposed controller demonstrates a fast current control response. The purpose of a second test is to evaluate the disturbances rejection effectiveness in presence of step load torque disturbance. The system is tested with value of 5 Nm load at 5.0s with 100rad/sec speed reference. From Figure 6, it is obvious that the proposed controller drop the speed from 100rad/sec to 90rad/sec with short settling time. While, adaptive NN controller with a random initialization drop the speed from 100rad/sec to 63rad/sec with largest settling time. The proposed speed controller produce significant improvement control performance compare to the adaptive NN controller such as reduce overshoot, settling time and rise time speed response. (dotted) with the proposed controller) The system robustness against the motor inertia changes is given in Figure 7. As can be seen, the increment of the moment of inertia does not impose any significant effect on the performance of the proposed controller technique but only affects the rise time. Furthermore, when carefully study Figure 7 according to the settling time and overshoot, the best performance belongs to the proposed controller. This means that the proposed controller is insensitive to parametric variations and a robust tracking performance is achieved in presence of the uncertain parameters.

CONCLUSION
In this paper, we have proposed a novel approach of speed control for PMSM combining PSO and adaptive NN. PSO algorithm was adopted to select initial weights and bias, presented as particles position, which were updated using movement and velocity update equations to avoid the weight and biases being trapped in local minima. Then, in each sampling period, to adapt the initially uncertain and varying parameters in the control system the gradient descent method was used to update the weights of controller.