LQR optimized BP neural network PI controller for speed control of brushless DC motor

This paper proposes a linear quadratic regulator (LQR) optimized back propagation neural network (BPNN) PI controller called LN-PI for the speed control of brushless direct current (BLDC) motor. The controller adopts BPNN to adjust the gain K P and K I of PI, which improves the dynamic characteristics and robustness of the controller. Moreover, LQR is adopted to optimize the output of BPNN so as to make it close to the target PI gains. Finally, the optimized control output is inputted into the BLDC motor system to achieve speed control. The performance analysis of the proposed controller is presented to compare with traditional PI controller, neural network PI controller and LQR optimized PI controller under MATLAB/Simulink, the results shows that the proposed controller effectively improves the response speed, reduces the steady-state error and enhances the anti-interference ability.


Introduction
Brushless direct current (BLDC) motor has been widely used in aerospace, robotics, electric vehicles and other fields because of its advantages such as simple structure, high efficiency, low maintenance, and high dynamic response. [1][2][3] As is known to all, there are many aspects of motor control, such as sensorless control, 4 current control, 5 torque control 6 and speed control, 2 etc. In order to achieve accurate speed and position control applications, speed regulation is an important aspect in the driving field of BLDC motor. 3,7,8 With the continuous rapid development of modern power electronic technology, sensor technology, automatic control technology and manufacturing technology, it is of great practical significance and application prospects to study speed controllers of BLDC motor with fast response, strong regulation ability and high control precision. However, the complex and strong coupling non-linear characteristics make it hard to achieve good performance for speed control by using traditional control methods. Therefore, many new controllers for speed control have been proposed to enhance the performance of BLDC motor in the last few decades. 2,[9][10][11][12] In order to improve the transient and steady-state characteristics of BLDC motor, proportional integral derivative (PID) controllers are often the best choice for BLDC motor speed regulation. Aiming at the speed control of BLDC motor, 13 a new PI controller variable speed pre-standard value control strategy is proposed. Experiments show that the controller can accurately adjust the speed in a wide range, with low cost and good stability. In Joice et al., 14 a PI-based controller has been developed for speed control of BLDC motor, and the speed controller increased sensitivity and reduced the speed overshooting by increasing the proportional gain. However, the dependence of traditional PID on gain selection seriously affects the performance of BLDC motor, and there are various uncertainties and nonlinearities. 15,16 Therefore, a variety of PID tuning methods are proposed, such as fuzzy logic, 2,15 sliding mode control, 11,17 genetic algorithm, 10 particle swarm optimization, 7,18 gray wolf optimization algorithm, 19 etc. However, the sliding mode PID controller inevitably has the chattering problem, which leads to the system performance degradation. The initial population of the genetic algorithm PID controller is not suitable. Particle swarm optimization and gray wolf optimization tend to lead to slow convergence rate and local optimization, while the fuzzy logic PID controller has poor coarseness. The reason for non-adaptation is to extract and adjust the fuzzy rules from the input/output data without providing an online adaptive learning method 12 In addition, the PID gain tuning process is a time consuming process, so many methods have been proposed to simplify or improve the PID gain tuning process. Neural network based algorithms have reported promising results. 16,[20][21][22][23] Neural network based PID gain update algorithms have been successfully implemented to control a servo motor, 24 computerized numerical control machine tools 21 and so on. In Xia et al., 25 a single neuron PI controller has been developed for the control of the BLDC motor. In Premkumar and Manikandan, 23 an adaptive neuro-fuzzy inference system tuned PID speed controller has been presented for BLDC motor. The proposed controller effectively tunes the gain of the PID controller. In Premkumar and Manikandan, 26 Online fuzzy logic supervised learning of radial basis function neural network based speed controller for BLDC motor was presented. This controller receives the supervised error by comparing the Fuzzy PID supervised algorithm output and output of the controller. Based on this supervised error, the parameter of RBFNN is updated in the network. Vikas et al. proposed a neural network-based PID-like controller composed of a mixed locally recurrent neural network and contains at most three hidden nodes which form a PID-like structure. 27 The presented controller is easy to implement. But the main drawback in such strategy is in the number of parameters to be determined prior to the training which requires a priori process knowledge. Moreover, the training algorithm based on gradient descent is a time consuming process. So some methods have been proposed to optimize the process. In Kang et al., 28 the particle swarm optimization algorithm is used to initialize the weight of the adaptive PID neural network controller, and the improved gradient descent algorithm is used to adjust the parameters of the PID neural network. The disadvantage of this method is that the particle swarm optimization algorithm initializes the PID neural network for a longer time. After decades of development, the classical optimal control theory has formed a well-known Linear Quadratic Regulators that minimizes the deviation of the system state trajectory and requires minimal controller effort. 29 This typical behavior of LQR has prompted control designers to use it to adjust PID controllers. 30,31 Although LQR optimized PID controller has good tracking performance and stable performance, its robustness still needs to be improved.
In view of the difficulty of determining the parameters of the neural network and the poor robustness of LQR, a new LQR optimized BP neural network PI controller which is called LN-PI is designed to achieve the speed control of BLDC motor in this paper. The main contributions of this paper are listed as follows: (1) BPNN is used to constantly adjust the gains of the PI controller according to the motion state of the BLDCM control system, so as to achieve the optimization of performance indexes, make the output state of the output neurons correspond to the gain values of the PI controller, which improves the dynamic characteristics and robustness of the controller. (2) A new LQR optimized BP neural network PI controller is proposed, which takes into account the problems of slow convergence speed and local extremes of BP neural network. LQR is used to optimize the output of BPNN so as to make it faster and closer to the optimal target PI controller gains. (3) The performance of LN-PI controller is evaluated through simulation and compared with conventional PI(C-PI) controller, neural network PI(NN-PI) controller and LQR optimized PI(LQR-PI) controller at different working conditions. The results show that LN-PI controller is superior to those related controllers in aspects such as overshoot, undershoot, stability time, recovery time and steady-state error. The speed controller of the BLDC motor Three phase star connected BLDC motor can be transformed into the circuit diagram shown in Figure 1. And the mathematical model of BLDC motor can be described by the following equation in matrix form, where V a , V b , V c are the phase voltages in volts, stator winding resistance is presented by R in ohms, i a , i b , i c denote the phase currents of the motor in amperes. L, M in Henry denote the self-inductance of the motor winding and the mutual inductances between stator windings respectively. e a , e b , e c represent the back electromagnetic force of each phase in volts. The number of poles in the rotor is represented by P, and u r is the rotor position of the rotor in radians. J , B, v r , T L denote the moment of inertia, frictional coefficient, angular velocity and load torque of the motor respectively. Moreover, the electromechanical torque is given in equation (2): Based on the model of BLDC motor described in Figure 1, the speed control system for BLDC motor is presented in Figure 2.
The system consists of three phase voltage source PWM inverter, three phase BLDC motor, LQR optimized BP neural network, conventional PI controller, switching logic and motor measurement sensors. Furthermore, two closed loops namely inner loop and outer loop are established based on the above blocks. In particularly, the outer loop is used for controlling the speed of the BLDC motor, and based on error, the LQR optimized BP neural network PI controller provides the control signal to the switching logic circuit so as to control the dc bus voltage thus by controlling the speed of the motor. The PI controller consists of proportional and derivative terms, which can be expressed as follows: where e(t), K P , K I , u(t) are the tracking error, proportional gain, integral gain, and control input, respectively. By taking the time-derivative of both sides of the continuous time PI equation and discretizing the resulting equation, we can obtain the discrete-time PI controller which can be expressed as: Where, T is the sampling period, k represents the running step of the discrete PI controller.

Design of BP neural network
This paper adopts a three-layer BP neural network, in which the input layer consists of 3 neurons (The number of neurons corresponds to e(k), e(k) À e(k À 1), e(k) À 2e(k À 1) + e(k À 2)), the hidden layer contains six neurons (The selection of the number of neurons is the best for multiple simulations.), and the output layer is made up of two neurons (The number of neurons corresponds to two gains of PI controller.). The structure is shown in Figure 3.
In Figure 3, x i is the actual input of the network, o kout (k = 1, 2) is the actual output of the network, o t kout (k = 1, 2) is the network target output, and DE, w ij , w jk , u j , u k are the control error, the first layer weight, the second layer weight, the bias of the jth hidden layer neurons, the bias of the kth output layer neurons, respectively. Then, the mapping relationship between the input and output of the network is shown as follows: Then the optimized PI gain can obtained where f 1 (x), f 2 (x) is the activation function of the hidden layer and output layer, and sigmoid function is shown as follows: The optimization process of LQR The design goal of the optimal control system is to minimize the error when the system tracks a certain command signal. The solution to this problem is: Suppose a discrete system, its discrete equation of state is where X k ð Þ is the (n 3 l)-dimensional state vector, O kout k ð Þ is the m-dimensional control vector, O k k ð Þ is the l-dimensional output vector, and F, G and C are n 3 n ð Þ, n 3 m ð Þ, l 3 n ð Þ dimensional system parameter matrix.  Assume that under a stable and appreciable com- where M and K are the feedback gain and feedforward gain matrices of m 3 n ð Þand m 3 l ð Þdimensions, which correspond to the error back propagation matrix and the output layer output matrix of BP neural network respectively, and O tk is a given instruction vector.
Suppose the system has a steady state equilibrium, which satisfies the stability of equations (12) and (13).
That is, If a new variable with a '' Ã '' is used to indicate that the system deviates from a steady state stationary state value (disturbance), then these new variables are defined as Substitute equations (19), (20), and (21) into equations (12) and (13) to get: Obviously, by subtracting the steady-state relations (16) and (18) from equations (22) and (23), a new difference equation can be obtained: And there is A new augmentation system can be formed by equations (24) and (27), Where Here V Ã k ð Þ is an m-dimensional vector. Seeking control input V Ã k ð Þ to minimize the following performance index J , where Q = CTSC is a semi-positive definite matrix of n 3 n ð Þ dimensions, and R is a positive definite matrix of m 3 m ð Þ dimensions. Under the constraint of equation (28), the performance index represented by equation (30) is minimized. Finding V Ã k ð Þ at this point is the same as the linear optimal regulator problem. Therefore, the optimal controller input V Ã k ð Þ of the augmentation system can be obtained as whereP is the Riccatti equation of the augmentation system and is a n + m ð Þ3 n + m ð Þdimensional positive definite matrix.

Design of LN-PI Controller
BP neural network has the advantages of strong parallel processing capability, strong nonlinear mapping ability and good fault tolerance. It has been used to adjust the gain of PID controller with different structures. However, BP neural network is difficult to achieve the global optimal solution, the convergence time is short, the parameters are difficult to determine, resulting in low precision and weak convergence. Therefore, introducing LQR into BPNN reduces the control error and obtains the optimal solution. Let BPNN input be x i (k), output O kout k ð Þ, and the control output at this time should be where g(x i (k)) = g(x 1 , x 2 , x 3 ) is the input and output nonlinear mapping function of BPNN.
Then, the final optimized PI gain can be expressed as Defining the Error Function of Training BPNN Weights, then the dynamic response of the controlled object can be accurately expressed by (12), the output of the BPNN network is zero (O kout k ð Þ = 0). This paper defines BPNN's performance indicators as where Connection weights W ij k ð Þ and W jk k ð Þ of BPNN are adjusted by the steepest descent method: Where h is the learning rate.
Let dK = d k o kout (k)½1 À o kout (k) ð 39Þ In the same way, ∂J k ∂W ij can be calculated, and the entire correction formula of the BPNN connection weight is obtained: where x i k ð Þ represents the input of the BPNN, b j is the hidden layer output, and O kout is the output of the output layer.
The specific steps of the BPNN type PID control algorithm based on LQR optimization are shown in Figure 4: (1) The structure of the BPNN is selected in advance, that is, the number of input layer nodes m and the number of hidden layer nodes q are selected, and the initial values W ij 0 ð Þ, W jk 0 ð Þ of the weighting coefficients of each layer are randomly generated between [21,1], select the learning rate h and let k = 1.
(2) Sampling to obtain r k ð Þ and y k ð Þ, and calculate e k ð Þ = r k ð Þ À y k ð Þ. (3) Normalize e(k), e(k) À e(k À 1), e(k) À 2e(k À 1) + e(k À 2) as an input to BPNN. (4) Calculate the output O kout of the BPNN output layer according to equation (3), and calculate the control output at this time as O k , which is the two adjustable parameters K P , K I of the controller.

Simulation results
The LN-PI controller is designed to further verify its speed control performance in the BLDC motor control system. The Matlab/Simulink toolbox is used to build the system model, and the controller is simulated and compared under different industrial control conditions. The simulation model of the BLDC motor control system is shown in Figure 5(a), the LN-PI controller is shown in Figure 5(b), and the specifications of the BLDC motor used in this paper like those in Ramya et al., 2 Afrasiabi and Yazdi 11 and Hu et al. 32 are given in Table 1.
The input speed of a given BLDC motor is 2500 rpm, the number of BP neural network nodes is 3-6-2, and the initial weight is [20.5, 0.5]. The weight is dynamically adjusted online with the system, and the learning rate is h = 0.05, R = 1. The experimental tests   obtained the K P and K I parameters of the four methods are shown in Table 2: Firstly, the tests are performed under the condition of no load. The comparison of speed response and current response is shown in Figures 6 and 7 respectively, and the performance indexes are given in Table 3.
As can be seen from Figure 6 and Table 3, the overshoot and undershoot of the C-PI controller are up to 314.46 and 90.86 rpm, while the LQR-PI undershoot is at least 3.07 rpm, The LN-PI controller has a minimum of 10.98 rpm. In the steady state process, the settling time of the C-PI controller is up to 0.081 s and the steady state error is the largest. The NN-PI and LQR-PI controllers are medium in terms of both stability time and steady state error. Horizontally, the LN-PI controller has a minimum convergence time of 0.015 s and a minimum steady state error. In addition, seen from Figure 7, the oscillation phenomena of C-PI and NN-PI are obvious and have a long duration, and LQR-PI and LN-PI have a fast stable speed. Overall, the performance of LN-PI controller is the best, which has the characteristics of fast response, small steadystate error and strong robustness.
Secondly, for the actual BLDC motor system, there will always be sudden external disturbances that are difficult to control. In the research of control algorithms, the robustness of the system is also an important indicator to judge the advantages and disadvantages of the control strategy, and has good anti-interference performance. The control strategy is what is needed in actual engineering control. In order to study the control effect of the anti-interference performance of these four control algorithms, 3 N external force interference is added to the system at 0.2 s. The comparison of speed response and current response is shown in Figures 8  and 9 respectively, and the performance indexes are given in Table 4.
It can be seen from Figure 8 and Table 4 that when the system suddenly increases the external force interference in 0.2 s, the four controllers generate the volatility response, and overshoot/undershoot occurs in the C-PI, NN-PI and LQR-PI controllers. Obviously, the     fluctuation of LN-PI is the smallest, the recovery time of the LN-PI controller is as short as 0.032 s, and the steady-state error is at least 0.41 rpm. It can be seen from Figure 9 that the oscillations of the C-PI, NN-PI, and LQR-PI controllers are obvious. Although the LN-PI controller has a higher oscillation amplitude, it can quickly restore the stability effect. Therefore, it is proved that the LN-PI controller has the best robustness and good anti-interference ability. Thirdly, in the actual working process, BLDC often needs to set different speeds to meet the needs of actual work. In order to study the speed control transition process, the simulation study of follow-up control by setting different speeds mainly studies the control effect of the transition process in which the set value changes. The control effects of these four control algorithms are compared mainly from the aspects of transient response speed, stability control accuracy and transient oscillation. The simulated target speed changes from 2500 to 1500 rpm and then to 2500 rpm. The comparison of speed response and current response is shown in Figures 10 and 11 respectively, and the performance indexes are given in Table 5.
It can be seen from Figure 10 and Table 5 that when the speed of 0.2 and 0.4 s changes, the response speed of the LN-PI controller is the fastest, taking 0.2 s as an example. The fluctuation of the C-PI controller is the largest. The overshooting and undershoot are 76.53 and 289.11 rpm, the LQR-PI controller has a minimum overshoot of 4.22 rpm, the LN-PI controller has a minimum undershoot of 18.63 rpm, and the LN-PI controller has the fastest recovery time. The value is 0.031 s and the steady state error is 0.40 rpm. Furthermore, it can also be seen from Figure 11 that when the speed changes, the current response oscillation time of the LN-PI controller is the shortest. Overall, the LN-PI controller has the best tracking performance when speed changes.
Under the above three operating conditions, the LN-PI controller is superior to other controllers. Next, the sensitivity of the LN-PI controller is analyzed under the operating conditions of parameter change of the inertia and the permanent magnetic flux of the BLDC motor. The inertia varies from 100%, 200%,300%, and 400% of the nominal inertia. The permanent magnetic flux varies from 50%, 100%, 150%, and 200% of the nominal. The sensitivity of the LN-PI controller is shown in Figure 12. It can be seen from the figure that, with the change of inertia, the speed response of BLDC motor is only affected by parameters such as overshoot and undershoot, but will not affect the final system output. When the permanent magnet flux changes, the speed response of BLDC motor is only affected by the steady state error, and the other parameters do not affect the system output. In addition, the variation of parameters such as overshoot and undershoot and steady-state error is not greater than 0.4% of nominal value. From the sensitivity analysis, the LN-PI controller is a suitable controller for wide operating conditions of the BLDC motor.

Conclusion
A LQR optimized BP neural network PI controller is proposed for speed control of brushless dc motor. BP neural network is adopted to adjust the gains of PID

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