Wavelet Neural Networks for Speed Control of BLDC Motor

In the recent years, researchers have sophisticated the synthesis of neural networks depending on the wavelet functions to build the wavelet neural networks (WNNs), where the wavelet function is utilized in the hidden layer as a sigmoid function instead of conventional sigmoid function that is utilized in artificial neural network. The WNN inherits the features of the wavelet function and the neural network (NN), such as self-learning, self-adapting, time-frequency location, robustness, and nonlinearity. Besides, the wavelet function theory guarantees that the WNN can simulate the nonlinear system precisely and rapidly. In this chapter, the WNN is used with PID controller to make a developed controller named WNN-PID controller. This controller will be utilized to control the speed of Brushless DC (BLDC) motor to get preferable performance than the traditional controller techniques. Besides, the particle swarm optimization (PSO) algorithm is utilized to optimize the parameters of the WNN-PID controller. The modification for this method of the WNN such as the recurrent wavelet neural network (RWNN) was included in this chapter. Simulation results for all the above methods are given and compared.


Introduction
Brushless DC (BLDC) motors have a wide application in our life due to their high-power density and high dynamic response. In addition, the BLDC motor is utilized with constant loads, varying loads, and position applications with high accuracy. This motor is generally controlled utilizing electronically commutation by three-phase power semiconductor bridge inverter with rotor position sensors that are required for starting and providing proper firing sequence to turn on the power devices in the inverter bridge. Based on the rotor position, the power devices are commutated sequentially every 60° [1,2]. The mathematical model and the Simulink model of BLDC motor to control the speed of a BLDC by using conventional methods are introduced in Refs. [2][3][4][5][6]. The DC-DC converter technique is utilized to control the speed of the motor [5,6].
In the past decade, artificial intelligence techniques such as neural networks, fuzzy-neural networks, and wavelet neural networks control have been utilized to control the speed of the BLDC motor [7][8][9][10]. Since BLDC motor is a multivariable and nonlinear system, it is complex to obtain high performance by applying classical PID control. The main objective of this chapter is to develop wavelet neural networks (WNNs) to control the speed of the BLDC motor, and the recurrent wavelet neural network (RWNN). These methods lead to an enhanced dynamic performance of the system of motor drive and are resistant to load perturbations. The learning strategy for the wavelet neural network and PID controller is developed based on PSO algorithm.

Wavelet networks
The combination of wavelet principle and neural networks has led to producing new representing network of wavelet neural network (WNN). Wavelet networks are feedforward networks utilizing wavelets as activation functions. Wavelet networks substitute the sigmoid activation components of the classical feedforward artificial neural networks (ANNs) with wavelets transform function. In wavelet neural networks, both the translation (position) and the dilation are tuning besides weights. The utilization of wavelet node outcomes in efficient networks are optimally approximated and estimated for nonlinear and nonstationary functions [11,12]. There are two main types to construct the wavelet neural network: • Wavenet (fixed grid WNs): in this type, the neural network and the wavelet processing are accomplished separately. The input signal is first decomposed utilizing some wavelet bases by neurons in the hidden layer with fixed wavelet bases; positions and dilations of the wavelets are preset and only the weights have to be adjusted by learning the network. The main problem is the choice of wavelet frames/bases [12,13].
• Wavelet network (adaptive WNs): this type merges the two theories, which are the dilation and the translation of wavelets along with the summer weights that are adjusted in conformity with some learning procedures. Generally, the modeling of the wavelet network involves two steps: determining the network construction (the number of neurons in each layer, the number of layers, and the type of activations function (wavelet transform)) and modifying the wavelet network parameters by some optimizing algorithm method [12,13].

Radial basis wavelet neural network (RBWNN)
Radial basis wavelet neural network (RBWNN) is the simplest form of the wavelet network [15,16]. The arrangement of radial basis wavelet neural network (RBWNN) is shown in Figure 1. This network approaches any required signal f(t) by simplifying a linear combination of a group of daughter wavelets ψ a,b , where ψ a,b are created by dilation a and translation b from mother wavelet ψ [11,17].
The network output is specified as follows [10,18]: where x is the input signal, N is the number of neuron in the hidden layer, and w N is the weights of the output. The network parameters w N , a N , and b N can be training and optimizing by any optimization technique. In this chapter, the PSO algorithm is used to minimize the error according to the fitness function as will be demonstrated later.

Conventional wavelet neural network
The conventional WNN is a general form of radial basis wavelet neural network [19]. Figure 2 depicts the building of the conventional wavelet network, the number of hidden layers and neurons that are selected to create an appropriate WNN, and the parameters that are optimized by the PSO algorithm. The input layer can be represented by a vector x ¼ x 1 , x 2 , … , x M ½ , the output layer represented by a vector y ¼ y 1 , y 2 , … , y K Â Ã , and the activation function of hidden layer is the wavelet basis function. The output Y j can be given as follows [11,19]: where, j ¼ 1, 2, 3, … , K; M is the number of inputs; K is the number of output layers; N is the number of hidden layers; g is the bias; and σ u ð Þ is the activation function of the output layer, the most common formula of activation function being sigmoid function which can be illustrated as follows [12]:

Recurrent wavelet neural networks (RWNNs)
In recurrent WNNs, the output depends not only on the present inputs of the network but also on the prior outputs or conditions of the network [12,15]. Recurrent networks have feedback and are also known as feedback networks. There are several types of recurrent networks that depend on the feedback connection [12][13][14][15][16][17][18][19][20][21][22].
In the recurrent wavelet network structures, the wavelet network input involves delayed samples of the system output y(k). The number of inputs increases with the order of the system actuality demonstrated. Figure 3 depicts the structure of recurrent wavelet network. Hence, the output for each layer can be calculated as [20,23,24]: where a N and b N are translation and dilation parameters of wavelets. The inputs of this layer for time n can be denoted as: where ∅ N represents the weight of the self-feedback loop. The output of the network is given as follow: where x is the input signal, N is the number of neuron in the hidden layer, w N is the output weight, D i , D 0 is the number of delay for the input and output network, and r n is the weight of the output feedback loop.

Particle swarm optimization
Particle swarm optimization is an inhabitance-based computational procedure motivated from the simulation of gregarious behaviors (social-psychological): fish schooling, bird flocking, and swarm theory. PSO was firstly invented and established by Eberhart and Kennedy [25,26]. In the PSO algorithm, in place of utilizing evolutionary operators such as mutation and crossover to operate algorithms, the population dynamics emulates a "bird flock" behavior, where social sharing of information takes place and individuals can yield from the finds and prior experience of all the other companions through the search for food. Therefore, each companion, called particle, in the population, which is called swarm intelligence as shown in Figure 4, is assumed to fly in several directions over the search space to meet the request fitness function [27,28].

Particle swarm optimization algorithm
The PSO algorithm is one of the evolutionary computation techniques to solve optimization troubles. In this algorithm, a swarm of individuals or entities called particles flies over the exploration space [29,30]. Each particle acts as a probable  solution to the optimization troubles. The position of a particle is influenced by the best position visited by itself, i.e., its own knowledge or experience and the position of the best particle in its knowledge of neighboring particles. When the neighborhood is the entire swarm, the best position in the neighborhood of the particle is denoted as the global best position and the resulting algorithm is referred to as the global best position PSO, where the finest prior position that gives the minimum fitness value of any particle is called local best position (lbest). The index of the best particle of all particles in the population is called global best position (gbest). The algorithm is generally referred to as the lbest PSO when smaller neighborhoods are used. For each particle, the performance is measured utilizing an objective function that differs depending on the optimization challenge. The basic PSO algorithm is given below according to the flow chart which is shown in Figure 5 [31][32][33][34][35].
Step 1. Generation of population particles Create particles regularly distributed over x, then choose the number of particles, number of iterations, modification accelerating coefficients c 1 and c 2 , the inertia weight (w) and random numbers R 1 , and R 2 to start the optimum searching.
Step 2. The initialization for each particle Initialize the present position x i t ð Þ and the velocitiy v i t ð Þ for each particle. The particles are randomly produced among the minimum and maximum limits of parameter values. Each particle is treated as a point in a D-dimensional space. The ith particle is denoted as Þ . The velocity for the particle i is represented as v i ¼ v i1 , v i2 , … , v iD ð Þ , then the local best position (lbest) and the global best position (gbest) are initialization.
Step 3. Evaluation of fitness function The overall performance (speed of convergence, efficiency, and optimization accuracy) of the PSO algorithm counts on the objective function that observes the optimization search. The objective function is chosen to minimize the reference constraints. The popular performance standards based on the error condition are integrated absolute error (IAE), integrated of time weight square error (ITSE), and integrated of square error (ISE) that can be estimated theoretically in the frequency domain [31,32,36]. In this chapter, multiobjective functions are utilized based on the integral of the squared error (ISE) criterion and overshoot (M p Þ criterion as follow [37,38]: where y(i) is the system output and D(i) is the desired output, while n is the actual speed and n ref is the desired speed.
Step 4. Update the swarm The updating of the velocity v i t ð Þ and the present position x i t ð Þ for each particle in the swarm is done according to Eqs. (13) and (14). Then the main loop and the objective function are calculated for updating positions of particles. If the new value is improved than the previous lbest, the new value is fixed to lbest. Similarly, gbest value is also updated as the best lbest. Velocity of each agent can be modification by the following: And, the present position can be modification by the following: where x k i is the present position of particle i at iteration k, v k i is the velocity of particle i at iteration k, w is the inertia weight which can be represented in Eq. (15), c 1 , c 2 represent positive acceleration constants and R 1 , R 2 are random variables uniformly distributed in the range [0; 1]. w ¼ w max À w max À w min ð Þ iter max (15) where, w min is the inital weight, w max is the final weight, iter max is the maximum iteration number.
Step 5. Stopping criteria If the current iteration number reaches the predetermined maximum iteration number, then exit. Otherwise, execute another initialization for each particle and reiterate the process.

Speed control of BLDC motor based on wavelet neural network
The WNN-PID controller based on PSO is proposed in this section, which combines the ability of the artificial neural networks for learning with the ability of wavelet for identification, control of dynamic system, and also having the capability of self-learning and adapting [10,11,19,37]. Two types of wavelet network are modified in this section, feedforward WNN and proposed recurrent WNN with online tuning optimization using PSO algorithm [22][23][24].

WNN-PID controller based on PSO
In this type of controller, the WNN is utilized with PID controller based on PSO algorithm. WNN-PID controller utilizes online learning by PSO algorithm, where the PSO learning algorithm is used to train the translation parameters a k and b k , weights connection in the WNN, and the parameter (k p , k i , k d ) of PID controller on-line with the model of BLDC motor to control the speed at the desired value. There are two major issues to implement any wavelet neural networks. First, the network architecture is used and second, the algorithm is used to learn the network by the PSO algorithm. Figure 6 depicts the block diagram of the BLDC motor with WNN-PID based on PSO algorithm. The structure and the design of the WNN-PID controller will be given in the next subsection.

Design of the structure of WNN-PID controller based on PSO training algorithm
1. Design of PSO algorithm: the PSO algorithm is discussed in Section 5, where each particle parameters are initiated to make a population and then the algorithm is accomplished according to the flow chart given in Figure 6, which includes training the parameters of this controller to guarantee the minimization of an objective function. The objective fitness is evaluated as follows: where ISE is the integrated of square error and M p is the maximum peak overshoot.

Design of WNN-PID controller:
to design the WNN-PID controller, the type of WNN must be selected as shown in Section 3 and also the number of layers and neurons and the wavelet function type must be selected [16]. In this chapter, the input layer has two inputs: the speed error and the change of this error. One hidden layer with four neurons is used. Three types of mother wavelet functions are used and they are: the Mexican hat function is [10,11,22,37,39] The first partial derivative Mexican hat is The Morlet's basic wavelet function is where x is the desired signal and w is a variable value, which was adopted to satisfy the admissibility condition. w = 5 is chosen. The output layer contains one output which is the sum of PID controller and WNN outputs. The parameters values of the WNN-PID controller, such as the dilation factors a k 0 s and the translation factors b k 0 s of the mother wavelet function, the weights connection w k 0 s of the WNN, and PID parameters (k p , k i , k d ), are optimized online in PSO algorithm. The results given in this chapter are for Mexican hat function only. The results for the rest functions are similar to that in Mexican hat and are not given.

Speed control based on feedforward WNN-PID controller
The feedforward WNN with PID controller (FWNN-PID) is utilized to control the speed of the BLDC motor as shown in the Simulink model in Figure 7. The inputs of the WNN are the speed error and the change of this error, while the hidden layer has four neurons and one output in the output layer. The translation and dilation factors, weights connection for WNN, and PID parameters are learning on-line in PSO algorithm. The output of WNN is given by Eq. (2).
The PSO parameters are given in Table 1. These parameters are chosen to get optimal parameters for the PID controller and the wavelet neural network; when it is tuned on-line in PSO algorithm and BLDC motor drive, the optimal values for the PID controller parameters and the WNN parameters (a's, b's, w's) are given in Tables 2 and 3, respectively.
The BLDC motor drive is implemented in Simulink/Matlab program as shown in Figure 6 with the optimal values of PID controller parameters and the optimal values of WNN parameters. Figure 8 shows the speed response of the BLDC motor due to change in reference speed. The motor is started at a speed of 500 rpm and then is changed in step to a speed of 500 rpm for every 0.2 s. The actual speed of the motor is tracking the desired speed with a good response. The system starts at no load and suddenly a torque 2 N m (full load) is added at t = 0.4 s. Figure 9 shows the speed response of the BLDC motor at 2000 rpm during no load and load condition. The developed torque during no load and load condition is shown in Figure 10. The position signal, the torque-speed characteristics, the phase current i a , Phase Backemf e a voltage, and line voltage v ab are given in Figures 11-15, respectively.

PSO_Parameters Value
Size of the swarm "no of birds" 50 Maximum iteration number 50

Speed control based on proposed recurrent WNN-PID controller
The RWNN that is proposed here is similar to that of feedforward WNN with feedback connections. The RWNN consists of three layers, with two inputs in the Step change in speed response with feedforward WNN-PID controller.  input layer, the hidden layer has four neurons, with one output in the output layer and feedback connection for each layer. In this section, the feedback connection is called "Fully feedback." Besides, the RWNN contains a number of delay samples in the input and output layers as shown in Figure 16. The translation and dilation factors, weights and PID parameters are learning on-line to utilize PSO method in   the same manner used in the previous subsection and the results are given in Tables 4-6. The output of WNN is described by Eqs. (7) and (8).
The BLDC motor drive system with RWNN-PID controller is simulated in Matlab/Simulink program as shown in Figure 6. The time period that is assumed in   this model is 1 s. The WNN-PID controller can be utilized for speed control in a wide range between 0 and the rated value, with better performance and more flexibility in the controller. Figure 17 depicts the step change in speed of the BLDC. The motor is started at a speed of 500 rpm and then is changed in step to 500 rpm each 0.2 s. The actual speed of the motor is tracking the desired speed with a good response. The system starts at no load and suddenly a torque 2 N m (full load) is added at t = 0.4 s. Figure 18 shows the speed response of the BLDC motor at 2000 rpm during no load and load conditions. The developed torque during no load and load conditions is shown in Figure 19. The position signal, the torque-speed characteristics, the phase current i a , Phase Back-emf e a voltage and line voltage v ab are given in Figures 20-24

Comparison of two methods for speed control of BLDC motor drive
Comparing among various wavelet neural network schemes shows that the WNN-PID is a preferable method to overcome the nonlinearity in this model with high reliability, more robustness and being good with better performance than the RWNN method as shown in Table 7. In addition, the performance of the WNN controller in the real application tends to make the system more robust and less sensitive as well as high precision and excellent flexibility.

Conclusion
In this chapter, the WNN is used with the PID controller to make an adapted controller named as the WNN-PID controller. This controller is utilized to control the speed of BLDC motor in an extensive range and can stock preferable performance than a traditional controller. Two schemes of wavelet neural network are modified for speed control of BLDC motor such as WNN and RWNN. PSO algorithm is utilized for tuning and learning the parameters of the two controllers. The two methods are implemented and tested for different conditions and the performance is compared as shown in Table 7. From the simulation results, one can conclude that the proposed WNN controller with PID controller is the best scheme in performance and stability. In addition, using the proposed WNN controller to control the speed of BLDC motor gives better results compared to traditional methods.