**Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor**

Omer Aydogdu and Ramazan Akkaya

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/49972

## **1. Introduction**

62 Fuzzy Controllers – Recent Advances in Theory and Applications

pp 1 - 4, March 1997

[24] D.N. O'Connor, S.D. Eppinger, W.P. Seering, D.N. Wormley, "Active Control of a High-Speed Pantograph", Journal of Dynamic Systems, Measurement, and Control, Vol 119,

[25] A. Balestrino, O. Bruno, A. Landi, L. Sani, "Innovative Solutions for Overhead Catenary-Pantograph System : Wire Actuated control and Observed Contact Force",

[26] A. Levant, A. Pisano, E. Usai, "Output-Feedback Control of the Contact Force in High-Speed-Train Pantographs", Proceedings of the 40th IEEE Conference on Decision and

[27] B. Allotta, A. Pisano, L. Pugi, E. Usai, "VSC of servo-actuated ATR90-type pantograph", Proceedings of the 44th IEEE Conference on Decision and the european Control

[28] Y. J. Huang, "Discrete fuzzy variable structure control for pantograph position control",

[29] Y. J. Huang, T. C. Kuo, "Discrete Pantograph Position Control for the High Speed Transportation Systems", Proceedings of the 2004 IEEE International Conference on

Networking, Sensing & Control Taipei, Taiwan, pp 21 – 23, March, 2004.

Vehicle System Dynamics, Volume 33, Issue 2, pp 69 – 89, 2000.

Control, pp 1831 – 1836, Orlando, Florida USA, December 2001.

Conference 2005, pp 590 - 595, Seville, Spain, December 2005.

Electrical Engineering 2004, No 86, pp 171 – 177.

Fuzzy controllers are nonlinear elements used in the control of linguistically defined systems, which can not be modeled accurately. Besides, they are an effective approach for various complex and ill-defined systems [1,2]. In design of fuzzy controllers, there is not well defined approach. The sophisticated and tedious design process is usually implemented by an expert. The success of the controller depends on the knowledge and skill of the expert. In some cases, even a very experienced and skillful expert's extensive efforts may not yield optimal solution for fuzzy controller design. The optimal design of fuzzy controller has a critical role for their more widespread and effective use. The design inherently requires the determination of a great deal of features and parameters. For this reason, fuzzy controller design problem has a number of local values in a large solution space in the direction of a number of objectives. The conventional trial-and-error based method makes the solution of the problem very difficult [3].

Genetic algorithms (GAs) are optimization strategies performing a stochastic search by iteratively processing 'populations' of solutions according to their fitness, i.e. a predefined scalar index of satisfaction of the design objectives. In control applications, the fitness is usually related to performance measures such as integral error, settling time, and so on. Fitness function may contain more than one objective like the minimization of settling time, steady state error and maximum overshoot. Thus, fitness function can be addressed as a multi objective function. GAs are effective in solving multi-objective optimization problems [4,5].

Most of the GA approaches in use represent the constraint variable using binary form of coding. One of the major disadvantages of using binary coding is the slow convergence

© 2012 Aydogdu and Akkaya, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

speed of the fitness function. Binary coding is also not at all efficient to be used in computer memory. Therefore, the use of real coded genetic algorithm can overcome the inefficient use of computer memory and can contribute the performance. This contribution becomes clear when a lot of parameters are needed to be adjusted in the same problem and higher precision is required for the final result. In literature, for real valued numerical optimization problem, floating point representations were proven to outperform binary representations because they are more consistent, more precise and they lead to faster execution. Also, real coded GA is inherently faster than the binary code GA, because the chromosomes do not have to be decoded prior to the evaluation of the objective function [6].

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 65

**Figure 1.** Real Coded GA based fuzzy control of the BLDC motor

**Figure 2.** Block diagram of the Real Coded GA based fuzzy controller

reference speed and the actual rotor speed.

The change in error *e*2 (*t*) is determined by Eq. (2) [9,10].

Here, *e*1(*t*) is the speed error, *ω\**

In closed-loop control systems, the use of error (*e*1) and the change in error (*e*2) as controller input is a universal approach. In the implemented fuzzy controller, error and change in error have been used as inputs. As given in Eq. (1), the error is the difference between the

In a fuzzy control system as shown in Figure 2, two normalization parameters (*n*1, *n*2) for inputs (*e*1, *e*2) and one denormalization parameter (*n*3) for output (*u*) is defined. In

<sup>1</sup> *\* e (t) <sup>ω</sup> (t) - <sup>ω</sup> (t)* (1)

2 1 *<sup>d</sup> e (t) e (t) dt* (2)

(*t*) is the reference speed and *ω*(*t*) is the actual motor speed.

Brushless DC (BLDC) motors are one of the motor types rapidly gaining popularity. Due to their favorable electrical and mechanical properties like high starting torque, high efficiency and noiseless operation, the BLDC motors are widely used in various consumer and industrial systems such as actuation, robotics, machine tools, servo motor drives, home appliances, computer peripherals, and automotive applications [5,7]. Operation of the BLDC motors requires non-linear control due to their non-linear characteristics and presence of sensors to estimate rotor position. Moreover, owing to some drawbacks of position sensors such as cost, space requirement and instability, sensorless speed control has recently gained importance [8]. It is possible to determine when to commutate the motor drive voltages by sensing the back emf voltage on an undriven motor terminal during one of the drive phases. Use of fuzzy controllers that have non-linear processes such as fuzzification, defuzzification and fuzzy inference is suitable for BLDC motor control.

In this study, sensorless speed control of the BLDC motor with real coded GA based fuzzy controller has been designed, simulated and practically implemented. ADSP-21992 digital signal processor (DSP) is used to realize the conventional and optimal fuzzy controller algorithms and sensorless speed control of the BLDC motor has been experimentally implemented successfully.

## **2. Real coded GA based fuzzy controller**

The realized control system general diagram is shown in Figure 1. As shown in the figure, the control system includes two closed loops. The inner loop is the fuzzy controller loop that accomplishes speed control of BLDC motor. The outer loop, which processes the fuzzy controller and system operations in background, is the genetic algorithm loop that tunes the controller parameters in regard to performance index of the control system.

## **2.1. Fuzzy controller**

In this study, Mamdani type fuzzy controller, which has five blocks namely normalization, fuzzifier, inference mechanism, defuzzifier and denormalization, has been used [8]. Block diagram of the real coded GA based fuzzy controller consisting two inputs (*e*1*, e*2) and one output (*u*) is shown in Figure 2.

**Figure 1.** Real Coded GA based fuzzy control of the BLDC motor

and fuzzy inference is suitable for BLDC motor control.

**2. Real coded GA based fuzzy controller** 

objective function [6].

implemented successfully.

**2.1. Fuzzy controller** 

output (*u*) is shown in Figure 2.

speed of the fitness function. Binary coding is also not at all efficient to be used in computer memory. Therefore, the use of real coded genetic algorithm can overcome the inefficient use of computer memory and can contribute the performance. This contribution becomes clear when a lot of parameters are needed to be adjusted in the same problem and higher precision is required for the final result. In literature, for real valued numerical optimization problem, floating point representations were proven to outperform binary representations because they are more consistent, more precise and they lead to faster execution. Also, real coded GA is inherently faster than the binary code GA, because the chromosomes do not have to be decoded prior to the evaluation of the

Brushless DC (BLDC) motors are one of the motor types rapidly gaining popularity. Due to their favorable electrical and mechanical properties like high starting torque, high efficiency and noiseless operation, the BLDC motors are widely used in various consumer and industrial systems such as actuation, robotics, machine tools, servo motor drives, home appliances, computer peripherals, and automotive applications [5,7]. Operation of the BLDC motors requires non-linear control due to their non-linear characteristics and presence of sensors to estimate rotor position. Moreover, owing to some drawbacks of position sensors such as cost, space requirement and instability, sensorless speed control has recently gained importance [8]. It is possible to determine when to commutate the motor drive voltages by sensing the back emf voltage on an undriven motor terminal during one of the drive phases. Use of fuzzy controllers that have non-linear processes such as fuzzification, defuzzification

In this study, sensorless speed control of the BLDC motor with real coded GA based fuzzy controller has been designed, simulated and practically implemented. ADSP-21992 digital signal processor (DSP) is used to realize the conventional and optimal fuzzy controller algorithms and sensorless speed control of the BLDC motor has been experimentally

The realized control system general diagram is shown in Figure 1. As shown in the figure, the control system includes two closed loops. The inner loop is the fuzzy controller loop that accomplishes speed control of BLDC motor. The outer loop, which processes the fuzzy controller and system operations in background, is the genetic algorithm loop that tunes the

In this study, Mamdani type fuzzy controller, which has five blocks namely normalization, fuzzifier, inference mechanism, defuzzifier and denormalization, has been used [8]. Block diagram of the real coded GA based fuzzy controller consisting two inputs (*e*1*, e*2) and one

controller parameters in regard to performance index of the control system.

**Figure 2.** Block diagram of the Real Coded GA based fuzzy controller

In closed-loop control systems, the use of error (*e*1) and the change in error (*e*2) as controller input is a universal approach. In the implemented fuzzy controller, error and change in error have been used as inputs. As given in Eq. (1), the error is the difference between the reference speed and the actual rotor speed.

$$
\boldsymbol{e}\_1(t) \ = \boldsymbol{\omega}^\*(t) \cdot \boldsymbol{\omega} \ (t) \tag{1}
$$

Here, *e*1(*t*) is the speed error, *ω\** (*t*) is the reference speed and *ω*(*t*) is the actual motor speed. The change in error *e*2 (*t*) is determined by Eq. (2) [9,10].

$$e\_2(t) = \frac{d}{dt} e\_1(t) \tag{2}$$

In a fuzzy control system as shown in Figure 2, two normalization parameters (*n*1, *n*2) for inputs (*e*1, *e*2) and one denormalization parameter (*n*3) for output (*u*) is defined. In

normalization process, the input values are scaled in the range [-1,+1] and in denormalization process the output values of fuzzy controller are converted to a value depending on the terminal control element. Obtaining the normalization and denormalization parameters of fuzzy controller is important for system stability.

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 67

**Input-***e***<sup>2</sup>** *NB NM NS Z PS PM PB* 

*i ii* 1 2 *<sup>μ</sup> u min <sup>μ</sup> e ,<sup>μ</sup> <sup>e</sup>* (4)

Sliding mode rule base table used by fuzzy controller is given in Table 1. In the sliding mode rule base, when an assumption is made such that *R*1= -*R*13, *R*2= -*R*12, *R*3= -*R*11, *R*4= -*R*10, *R*5= -*R*9, *R*6= -*R*8, it is required to determine a minimum of seven parameters (*R*1-*R*7) by using real

*NB R*1 *R*2 *R*3 *R*4 *R*5 *R*6 *R*<sup>7</sup> *NM R*2 *R*3 *R*4 *R*5 *R*6 *R*7 *R*<sup>8</sup> *NS R*3 *R*4 *R*5 *R*6 *R*7 *R*<sup>8</sup> *R*<sup>9</sup> *Z R*4 *R*5 *R*6 *R*7 *R*<sup>8</sup> *R*<sup>9</sup> *R*<sup>10</sup> *PS R*5 *R*6 *R*7 *R*<sup>8</sup> *R*<sup>9</sup> *R*<sup>10</sup> *R*<sup>11</sup> *PM R*6 *R*7 *R*<sup>8</sup> *R*<sup>9</sup> *R*<sup>10</sup> *R*<sup>11</sup> *R*<sup>12</sup> *PB R*7 *R*<sup>8</sup> *R*<sup>9</sup> *R*<sup>10</sup> *R*<sup>11</sup> *R*<sup>12</sup> *R*<sup>13</sup>

The developed fuzzy logic uses the min-max compositional rule of inference. The inference mechanism of fuzzy controller is implemented in regard to the rule base given by Eq. (4).

Fuzzy controllers are nonlinear tools because of the nonlinearity of logical inference, fuzzifier and defuzzifier processes. As mentioned earlier, design of fuzzy controller requires determination of a minimum of 16 parameters comprised of three normalization parameters, six membership function parameters and seven sliding mode rule base parameters. The parameters are decided in regard to the symetrical properties of the controller and that imposes limitations for the controller. The reduction of the number of parameters gives acceptable results and it can be preferred in design process to simplify the

In problem solving, the precision of the numbers is crucial. In binary coded GA, the accuracy is limited by the size of the chromosomes. However, the use of real coded GA, which can be coded by real numbers, is advantageous. Real coded GA is more accurate and occupies less space in memory. In literature, it has been reported that, real coded GAs operate faster than binary coded GAs and they can converge to global optimum faster [11]. Also, in the optimization of systems consisting a great deal of parameters to be optimized as in fuzzy controllers, the chromosomes in the binary coded GA becomes too long and the parameter accuracy can not be handled. However, in the developed algorithm, the parameters are coded by integer number set and the parameter accuracy can be determined arbitrarily. Also, in the

**2.2. Optimization of fuzzy controller by means of real coded GA** 

**if** *e*1 is *NB* **and** *e*2 is *NB* **then** *u* is *R*1, **if** *e*1 is *NB* **and** *e*2 is *NM* **then** *u* is *R*2,

coded GA.

**Input-***e***<sup>1</sup>**

**Table 1.** Sliding mode rule base

sophisticated optimization process.

In the fuzzifier process, the crisp input values (*e*1, *e*2) are converted into fuzzy values. Also, the fuzzy values obtained in fuzzy inference mechanism must be converted to crisp output value (*u*) by defuzzifier process. For this purpose, triangular fuzzy membership function is defined for each input and output values by seven clusters. Figure 3, illustrates the membership function used to fuzzify two input values (*e*1, *e*2) and defuziffy output (*u*) of the realized fuzzy controller. For seven clusters in the membership functions as shown in Figure 3, seven linguistic variables are defined as; Negative Big (*NB*), Negative Medium (*NM*), Negative Small (*NS*), Zero (*Z*), Positive Small (*PS*), Positive Medium (*PM*) and Positive Big (*PB*). Initially, the overlap rates of membership functions are 50%. As illustrated in Figure 3, peak or bottom points of membership functions to be tuned are defined as *a*1 and *a*2 for *e*1, *b*<sup>1</sup> and *b*2 for *e*2, *c*1 and *c*2 for *u*. Therefore, the design of optimal fuzzy controller requires optimization of at least six parameters (*a*1, *a*2, *b*1, *b*2, *c*1, *c*2) by using real coded GA for fuzzification and defuzzification processes that are both nonlinear.

**Figure 3.** Membership functions of (a) input (*e*1,*e*2), (b) output (*u*)

In this study, the center-of-gravity method given by Eq. (3) has been used in defuzzifier process for simulation and real time DSP application.

$$\mu = \frac{\sum\_{i=1}^{m} d\_{\hat{i}} A(\mu\_{\hat{i}})}{\sum\_{i=1}^{m} A(\mu\_{\hat{i}})} \tag{3}$$

Here, *u* is the fuzzy controller output, *di* is the distance between *ith* fuzzy set and the center, *A(μi)* is the area value of *i th* fuzzy set.

The rule definition is subjective and based on the expert's knowledge and experience. For the system with two inputs and seven membership functions in each range, it leads to a 7x7 decision table and 49 fuzzy rules. For example, two fuzzy rules are decribed as;

**if** *e*1 is *NB* **and** *e*2 is *NB* **then** *u* is *R*1, **if** *e*1 is *NB* **and** *e*2 is *NM* **then** *u* is *R*2,

66 Fuzzy Controllers – Recent Advances in Theory and Applications

normalization process, the input values are scaled in the range [-1,+1] and in denormalization process the output values of fuzzy controller are converted to a value depending on the terminal control element. Obtaining the normalization and

In the fuzzifier process, the crisp input values (*e*1, *e*2) are converted into fuzzy values. Also, the fuzzy values obtained in fuzzy inference mechanism must be converted to crisp output value (*u*) by defuzzifier process. For this purpose, triangular fuzzy membership function is defined for each input and output values by seven clusters. Figure 3, illustrates the membership function used to fuzzify two input values (*e*1, *e*2) and defuziffy output (*u*) of the realized fuzzy controller. For seven clusters in the membership functions as shown in Figure 3, seven linguistic variables are defined as; Negative Big (*NB*), Negative Medium (*NM*), Negative Small (*NS*), Zero (*Z*), Positive Small (*PS*), Positive Medium (*PM*) and Positive Big (*PB*). Initially, the overlap rates of membership functions are 50%. As illustrated in Figure 3, peak or bottom points of membership functions to be tuned are defined as *a*1 and *a*2 for *e*1, *b*<sup>1</sup> and *b*2 for *e*2, *c*1 and *c*2 for *u*. Therefore, the design of optimal fuzzy controller requires optimization of at least six parameters (*a*1, *a*2, *b*1, *b*2, *c*1, *c*2) by using real coded GA for

In this study, the center-of-gravity method given by Eq. (3) has been used in defuzzifier

1

 

*m d A(<sup>μ</sup> ) i i <sup>i</sup> <sup>u</sup> m*

 

1

Here, *u* is the fuzzy controller output, *di* is the distance between *ith* fuzzy set and the center,

The rule definition is subjective and based on the expert's knowledge and experience. For the system with two inputs and seven membership functions in each range, it leads to a 7x7

decision table and 49 fuzzy rules. For example, two fuzzy rules are decribed as;

*A(μ ) <sup>i</sup> <sup>i</sup>*

(3)

denormalization parameters of fuzzy controller is important for system stability.

fuzzification and defuzzification processes that are both nonlinear.

**Figure 3.** Membership functions of (a) input (*e*1,*e*2), (b) output (*u*)

*th* fuzzy set.

process for simulation and real time DSP application.

*A(μi)* is the area value of *i*

Sliding mode rule base table used by fuzzy controller is given in Table 1. In the sliding mode rule base, when an assumption is made such that *R*1= -*R*13, *R*2= -*R*12, *R*3= -*R*11, *R*4= -*R*10, *R*5= -*R*9, *R*6= -*R*8, it is required to determine a minimum of seven parameters (*R*1-*R*7) by using real coded GA.


**Table 1.** Sliding mode rule base

The developed fuzzy logic uses the min-max compositional rule of inference. The inference mechanism of fuzzy controller is implemented in regard to the rule base given by Eq. (4).

$$
\mu\_i(u) = \min\left(\mu\_i(e\_1), \mu\_i(e\_2)\right) \tag{4}
$$

Fuzzy controllers are nonlinear tools because of the nonlinearity of logical inference, fuzzifier and defuzzifier processes. As mentioned earlier, design of fuzzy controller requires determination of a minimum of 16 parameters comprised of three normalization parameters, six membership function parameters and seven sliding mode rule base parameters. The parameters are decided in regard to the symetrical properties of the controller and that imposes limitations for the controller. The reduction of the number of parameters gives acceptable results and it can be preferred in design process to simplify the sophisticated optimization process.

## **2.2. Optimization of fuzzy controller by means of real coded GA**

In problem solving, the precision of the numbers is crucial. In binary coded GA, the accuracy is limited by the size of the chromosomes. However, the use of real coded GA, which can be coded by real numbers, is advantageous. Real coded GA is more accurate and occupies less space in memory. In literature, it has been reported that, real coded GAs operate faster than binary coded GAs and they can converge to global optimum faster [11]. Also, in the optimization of systems consisting a great deal of parameters to be optimized as in fuzzy controllers, the chromosomes in the binary coded GA becomes too long and the parameter accuracy can not be handled. However, in the developed algorithm, the parameters are coded by integer number set and the parameter accuracy can be determined arbitrarily. Also, in the developed algorithm, binary coding can be accomplished in the limited valued parameters for the optimization of sliding mode rule base table (*R*1, *R*2, *R*3, *R*4, *R*5, *R*6, *R*7).

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 69

sequentially. This approach is similar to the self-tuning adaptive system employed in adaptive control systems. The second approach is a method based on the simultaneous optimization of normalization factors, membership functions and rules. Fuzzy controller parameters are not fully independent of each other [12]. For this reason, simultaneously tuning of all the parameters is the optimum solution. However, the large number of fuzzy control parameters

The performance index defined for the fuzzy controller is given in Eq.(5) [3]. This equation has also been used as multiple objective function employed in optimization process for real

1 1 1

*dt* (5)

*<sup>d</sup><sup>ω</sup> J e dt e t dt <sup>δ</sup> e dt*

In Eq.(5), *Jin* is the performance index used as fitness value in real coded GA, *e*1 is the error value and *t*1 is the settling time of the reference speed in BLDC motor fuzzy control system. In Figure 5 (a), the coding of three normalization parameters in six digit number string in real coded GA is depicted. Here, in six digit number string, two of it is assigned for integer part and four of it is for the fractional part. As shown in Figure 5 (b), a total of six coding has been implemented for three membership functions. Here, *a*1 and *a*2 are the membership function parameters defined for input (*e*1); *b*1 and *b*2 are the membership function parameters defined for input (*e*2); and *c*1 and *c*2 are the membership function parameters defined for output (*u*). All obtained membership function parameters are less than one. In Figure 5 (c), the sliding mode rule base parameters presented in Table 1 are shown. These parameters take integer values in the range [1,2,3]. Therefore, each parameter is denoted by one digit. As shown in Figure 5, a total of 63 digits have been used for all of the codes. Additionally, the precision of parameters can be increased by increasing the number of digits. In coding

1

*t*

structure shown in Figure 5, the precision of membership functions is 0.0001.

**Figure 5.** Coding of the fuzzy parameters in real coded GA, (a) Normalization, (b) Membership

functions, and (c) Sliding mode rule table

0 0 6 *t t t*

makes the second approach more difficult to implement.

1

*in*

coded GA.

In Figure 4, the flowchart of real coded GA used in the study is shown. Some of the GA parameters such as the possible lower and upper limit values of parameters, the precision of parameters, the termination criterion or loop number, the mutation probability, the crossover probability, the population number and elitism property is required to be initialized.

**Figure 4.** Flowchart of the Real Coded GA based fuzzy controller

In the proposed algorithm, the normalization parameters (*n*1, *n*2) and de-normalization parameter (*n*3), the membership function parameters (*a*1, *a*2, *b*1, *b*2, *c*1, *c*2) and rule base (*R*1, *R*2, *R*3, *R*4, *R*5, *R*6, *R*7) of the fuzzy controller have been optimized. Two approaches have been used in determination of parameters in optimal design of fuzzy controller by using real coded GA. In the first approach, the parameters for optimal fuzzy controller have been determined sequentially. This approach is similar to the self-tuning adaptive system employed in adaptive control systems. The second approach is a method based on the simultaneous optimization of normalization factors, membership functions and rules. Fuzzy controller parameters are not fully independent of each other [12]. For this reason, simultaneously tuning of all the parameters is the optimum solution. However, the large number of fuzzy control parameters makes the second approach more difficult to implement.

68 Fuzzy Controllers – Recent Advances in Theory and Applications

**Figure 4.** Flowchart of the Real Coded GA based fuzzy controller

In the proposed algorithm, the normalization parameters (*n*1, *n*2) and de-normalization parameter (*n*3), the membership function parameters (*a*1, *a*2, *b*1, *b*2, *c*1, *c*2) and rule base (*R*1, *R*2, *R*3, *R*4, *R*5, *R*6, *R*7) of the fuzzy controller have been optimized. Two approaches have been used in determination of parameters in optimal design of fuzzy controller by using real coded GA. In the first approach, the parameters for optimal fuzzy controller have been determined

developed algorithm, binary coding can be accomplished in the limited valued parameters for

In Figure 4, the flowchart of real coded GA used in the study is shown. Some of the GA parameters such as the possible lower and upper limit values of parameters, the precision of parameters, the termination criterion or loop number, the mutation probability, the crossover

probability, the population number and elitism property is required to be initialized.

the optimization of sliding mode rule base table (*R*1, *R*2, *R*3, *R*4, *R*5, *R*6, *R*7).

The performance index defined for the fuzzy controller is given in Eq.(5) [3]. This equation has also been used as multiple objective function employed in optimization process for real coded GA.

$$J\_{in} = \bigcap\_{0}^{t\_1} e\_1 \mid dt + \bigwedge\_{t\_1}^{t} e\_1 \mid t \; dt + 6 \int\_0^t \delta \left( \frac{d\omega}{dt} \right) \mid e\_1 \mid dt \tag{5}$$

In Eq.(5), *Jin* is the performance index used as fitness value in real coded GA, *e*1 is the error value and *t*1 is the settling time of the reference speed in BLDC motor fuzzy control system.

In Figure 5 (a), the coding of three normalization parameters in six digit number string in real coded GA is depicted. Here, in six digit number string, two of it is assigned for integer part and four of it is for the fractional part. As shown in Figure 5 (b), a total of six coding has been implemented for three membership functions. Here, *a*1 and *a*2 are the membership function parameters defined for input (*e*1); *b*1 and *b*2 are the membership function parameters defined for input (*e*2); and *c*1 and *c*2 are the membership function parameters defined for output (*u*). All obtained membership function parameters are less than one. In Figure 5 (c), the sliding mode rule base parameters presented in Table 1 are shown. These parameters take integer values in the range [1,2,3]. Therefore, each parameter is denoted by one digit. As shown in Figure 5, a total of 63 digits have been used for all of the codes. Additionally, the precision of parameters can be increased by increasing the number of digits. In coding structure shown in Figure 5, the precision of membership functions is 0.0001.

**Figure 5.** Coding of the fuzzy parameters in real coded GA, (a) Normalization, (b) Membership functions, and (c) Sliding mode rule table

In the implemented algorithm, the initial population can be preferably set by the user or can be randomly appointed a value in regard to Eq.(6). An important feature of random generator is that in each execution of the algorithm different values are initialized.

$$N\_{ipop} = (P\_{\text{h}} - P\_{\ell}) \; \text{Random } (P\_{pop}) + P\_{\ell} \tag{6}$$

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 71

*i* are the reference phase currents (Amper), *S*1-

) is produced for control system. The current

the actual phase currents (Amper), *\**

*a i* , *\* b i* , *\* c*

**Figure 6.** Block diagram of sensorless control of the BLDC motor drive system

in fuzzy controller and reference current (*I\**

position sensor requirement.

motor.

**3.1. Modeling of the BLDC motor** 

In speed control loop as shown in the block digram, the reference speed and the actual motor speed is compared and the error signal is obtained. These signals (*e*1, *e*2) are employed

control loop regulates the BLDC motor current to the reference current value generated by the speed controller. The current control loop consists of reference current generator, PWM current control unit and a three phase voltage source inverter (VSI). Position of the BLDC motor is obtained by employing zero crossing back emf detection method eliminating

Figure 7 describes the basic building blocks of the BLDC motor and inverter that results in a system producing a linear speed-torque characteristic similar to the conventional DC motor. BLDC motor has three phase windings on the stator similar to three phase squirrel cage induction motor and magnets are placed on the rotor to provide air gap flux resulting in brushless rotor construction. When the motor is operated at a certain speed, trapezoidal emfs are induced in stator phase windings. The quasi-square wave AC current is fed to stator phase windings through electronic commutator using current controlled voltage source inverter and rotor position sensor resulting in constant torque development by the

At any instant, two out of three phase stator windings of the motor carry currents synchronized with developed electromagnetic torque as shown in Figure 8. Active switching states for three phase inverter operation, three phase back-emf waveforms and torques of all phases are illustrated in Figure 8. Here, three phase PWM inverter operation

can be divided into six modes according to the current conduction states.

*S*6 are switches of the inverter and *Vdc* is the supply voltage of the inverter (Volt).

Here, *Nipop* is the initial population, *Ph* and *Pℓ* are the minimum and maximum values the parameter can have and *Ppop* is the random number generated between zero and one. Fitness value of each chromosome in initial population is determined by using performance index which is given by Eq.(5). As shown in the Figure 4, if the termination criterion is met, real coded GA loop ends but optimal fuzzy control system keeps operating. Else, next step in real coded GA is executed. In this study, Roulette wheel method is employed in natural selection process. In binary coded GA, the crossover operation can be implemented by using methods like single-point or two-point crossover. However, in real coded GA, the mixing methods give better results in crossover operation. In mixing method, the values of two parameter are compared and new generations are produced using Eq. (7).

$$P\_{new} = \beta P\_{an} + (1 - \beta)P\_{bn} \tag{7}$$

where is a number randomly generated between 0 and 1, *Pan* is the *nth* parameter of mother chromosome, *Pbn* is the *nth* parameter of father chromosome [13,14].

Genetic algorithms sometimes converge prematurely. In order to prevent convergence to a local point, new solutions are obtained by means of mutation. In this study, the number of parameters to be applied to the mutation operation has been determined by multiplying the total number of parameters with mutation rate. The elements to apply mutation operation are determined and they are replaced by randomly generated numbers.

In the developed algorithm, the elitism, a mechanism in which the individuals with the best fitness values in previous population are guaranteed their place in the next population, is implemented by selecting. Later, new fitness value is determined again for new population. Optimization process goes on until the termination criterion is met.

## **3. Sensorless control of BLDC motor**

The BLDC control drive system is based on the feedback of rotor position, which is obtained at fixed points typically every 60 electrical degrees for six-step commutations of the phase currents. So, the operation of BLDC motor requires a control system and position sensors to estimate rotor position. Rotor position is sensed using Hall effect sensors embedded into the stator frequently. However, sensorless speed control has recently gained importance owing to the elimination of some drawbacks of sensors such as cost, space requirement and instability. Figure 6 shows basic block diagram of sensorless control of BLDC motor with real coded GA based fuzzy controller.

In Figure 6, *\* ω* is the reference speed (rad/sec), *ω* is the actual rotor speed (rad/sec), *θ* is the rotor position (degree), *u* is the control signal used to reference moment (N-m), *ia*, *ib*, *ic* are the actual phase currents (Amper), *\* a i* , *\* b i* , *\* c i* are the reference phase currents (Amper), *S*1- *S*6 are switches of the inverter and *Vdc* is the supply voltage of the inverter (Volt).

**Figure 6.** Block diagram of sensorless control of the BLDC motor drive system

In speed control loop as shown in the block digram, the reference speed and the actual motor speed is compared and the error signal is obtained. These signals (*e*1, *e*2) are employed in fuzzy controller and reference current (*I\** ) is produced for control system. The current control loop regulates the BLDC motor current to the reference current value generated by the speed controller. The current control loop consists of reference current generator, PWM current control unit and a three phase voltage source inverter (VSI). Position of the BLDC motor is obtained by employing zero crossing back emf detection method eliminating position sensor requirement.

## **3.1. Modeling of the BLDC motor**

70 Fuzzy Controllers – Recent Advances in Theory and Applications

where 

In the implemented algorithm, the initial population can be preferably set by the user or can be randomly appointed a value in regard to Eq.(6). An important feature of random

Here, *Nipop* is the initial population, *Ph* and *Pℓ* are the minimum and maximum values the parameter can have and *Ppop* is the random number generated between zero and one. Fitness value of each chromosome in initial population is determined by using performance index which is given by Eq.(5). As shown in the Figure 4, if the termination criterion is met, real coded GA loop ends but optimal fuzzy control system keeps operating. Else, next step in real coded GA is executed. In this study, Roulette wheel method is employed in natural selection process. In binary coded GA, the crossover operation can be implemented by using methods like single-point or two-point crossover. However, in real coded GA, the mixing methods give better results in crossover operation. In mixing method, the values of two

is a number randomly generated between 0 and 1, *Pan* is the *nth* parameter of mother

Genetic algorithms sometimes converge prematurely. In order to prevent convergence to a local point, new solutions are obtained by means of mutation. In this study, the number of parameters to be applied to the mutation operation has been determined by multiplying the total number of parameters with mutation rate. The elements to apply mutation operation

In the developed algorithm, the elitism, a mechanism in which the individuals with the best fitness values in previous population are guaranteed their place in the next population, is implemented by selecting. Later, new fitness value is determined again for new population.

The BLDC control drive system is based on the feedback of rotor position, which is obtained at fixed points typically every 60 electrical degrees for six-step commutations of the phase currents. So, the operation of BLDC motor requires a control system and position sensors to estimate rotor position. Rotor position is sensed using Hall effect sensors embedded into the stator frequently. However, sensorless speed control has recently gained importance owing to the elimination of some drawbacks of sensors such as cost, space requirement and instability. Figure 6 shows basic block diagram of sensorless control of BLDC motor with

In Figure 6, *\* ω* is the reference speed (rad/sec), *ω* is the actual rotor speed (rad/sec), *θ* is the rotor position (degree), *u* is the control signal used to reference moment (N-m), *ia*, *ib*, *ic* are

*N (P - P ) Random (P ) P ipop h pop* (6)

<sup>1</sup> *new an bn <sup>P</sup> <sup>β</sup>P ( <sup>β</sup>)P* (7)

generator is that in each execution of the algorithm different values are initialized.

parameter are compared and new generations are produced using Eq. (7).

chromosome, *Pbn* is the *nth* parameter of father chromosome [13,14].

are determined and they are replaced by randomly generated numbers.

Optimization process goes on until the termination criterion is met.

**3. Sensorless control of BLDC motor** 

real coded GA based fuzzy controller.

Figure 7 describes the basic building blocks of the BLDC motor and inverter that results in a system producing a linear speed-torque characteristic similar to the conventional DC motor. BLDC motor has three phase windings on the stator similar to three phase squirrel cage induction motor and magnets are placed on the rotor to provide air gap flux resulting in brushless rotor construction. When the motor is operated at a certain speed, trapezoidal emfs are induced in stator phase windings. The quasi-square wave AC current is fed to stator phase windings through electronic commutator using current controlled voltage source inverter and rotor position sensor resulting in constant torque development by the motor.

At any instant, two out of three phase stator windings of the motor carry currents synchronized with developed electromagnetic torque as shown in Figure 8. Active switching states for three phase inverter operation, three phase back-emf waveforms and torques of all phases are illustrated in Figure 8. Here, three phase PWM inverter operation can be divided into six modes according to the current conduction states.

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 73

Back-emf waveforms of all phases are equal under above assumptions. A BLDC motor

1 00 0 0 01 0 0 0

*i /L v R/L i <sup>d</sup> <sup>i</sup> /L v R/L i dt <sup>i</sup> /L v R/L i*

*aa a bb b cc c a*

*b sm*

*<sup>ω</sup> (T T Bω) dt J* (9)

*e aa bb cc T (e i e i e i ) / ω* (11)

*dt* (10)

(12)

(8)

0 01 0 0

*c*

where *va, vb*, and *vc* are the phase voltages, *ia, ib*, and *ic* are the phase currents, *R* and *Ls* are the stator resistance and inductance, *Lm* is the mutual inductance, *ea, eb*, and *ec* are the trapezoidal

*<sup>d</sup> θ ω*

where *Tℓ* is the load torque in Nm, *J* is the moment of inertia in kgm2, *B* is the frictional coefficient in Nms/rad, and ω is the rotor speed in electrical rad/sec. The output torque is

This torque expression causes a computational difficulty at zero speed as the induced emf is zero. In this study, the trapezoidal back-emf waveforms are modeled as a function of rotor

position to be able to estimate position actively according to the operation speed.

 *a a*

*e f(θ)*

*e f(θ)*

*c c*

*bb e*

*e E f(θ) , (E k ω)*

where *ke* is back-emf constant, *fa* (*θ*)*, fb* (*θ*), and *fc* (*θ*) are the functions of rotor position as shown in Figure 8. In this study, *fa* (*θ*) trapezoidal function with limit values between +1 and

The back-emfs can be expressed as a function of rotor position (*θ*) [17];

*/L e*

1 *e*

*d*

*/ L e (L L - L )*

1 00 01 0 0 01 ,

*/ L e*

model can be represented as;

The motion equation is expressed as;

redefined by Eq.(11) using back-emfs.

**3.2. Modeling of trapezoidal back-emf** 


back-emfs.

**Figure 7.** Configuration of the BLDC motor and inverter system

**Figure 8.** (a) Active switches, (b) Back emf and phase current waveforms, and (c) Three phase torques of the BLDC motor drive system

Analysis of the BLDC motor is based on the following assumptions for simplicity and accuracy [3,10,15,16].


Back-emf waveforms of all phases are equal under above assumptions. A BLDC motor model can be represented as;

$$
\frac{d}{dt}\begin{bmatrix}\dot{i}\_a\\ \dot{i}\_b\\ \dot{i}\_c\end{bmatrix} = \begin{bmatrix}1/L & 0 & 0\\ 0 & 1/L & 0\\ 0 & 0 & 1/L\end{bmatrix} \begin{bmatrix}v\_a\\ v\_b\\ v\_c\end{bmatrix} - \begin{bmatrix}R/L & 0 & 0\\ 0 & R/L & 0\\ 0 & 0 & R/L\end{bmatrix} \begin{bmatrix}\dot{i}\_a\\ \dot{i}\_b\\ \dot{i}\_c\end{bmatrix} - \tag{8}
$$

$$
\begin{bmatrix}1/L & 0 & 0\\ 0 & 1/L & 0\\ 0 & 0 & 1/L\end{bmatrix} \begin{bmatrix}e\_a\\ e\_b\\ e\_c\end{bmatrix}, \quad (L = L\_s - L\_m)
$$

where *va, vb*, and *vc* are the phase voltages, *ia, ib*, and *ic* are the phase currents, *R* and *Ls* are the stator resistance and inductance, *Lm* is the mutual inductance, *ea, eb*, and *ec* are the trapezoidal back-emfs.

The motion equation is expressed as;

72 Fuzzy Controllers – Recent Advances in Theory and Applications

**Figure 7.** Configuration of the BLDC motor and inverter system

of the BLDC motor drive system

4. Iron losses are negligible.

1. The BLDC motor is not saturated.

3. Semiconductor devices in the inverter are ideal.

accuracy [3,10,15,16].

constant.

**Figure 8.** (a) Active switches, (b) Back emf and phase current waveforms, and (c) Three phase torques

Analysis of the BLDC motor is based on the following assumptions for simplicity and

2. Stator resistances of all the windings are equal, self and mutual inductances are

$$\frac{d}{dt}\omega = \frac{1}{J}(T\_e - T\_\ell - B\omega) \tag{9}$$

$$\frac{d}{dt}\Theta = \omega \tag{10}$$

where *Tℓ* is the load torque in Nm, *J* is the moment of inertia in kgm2, *B* is the frictional coefficient in Nms/rad, and ω is the rotor speed in electrical rad/sec. The output torque is redefined by Eq.(11) using back-emfs.

$$T\_e = (e\_a \ i\_a + e\_b \ i\_b + e\_c \ i\_c) \ / \ \ \omega \tag{11}$$

This torque expression causes a computational difficulty at zero speed as the induced emf is zero. In this study, the trapezoidal back-emf waveforms are modeled as a function of rotor position to be able to estimate position actively according to the operation speed.

#### **3.2. Modeling of trapezoidal back-emf**

The back-emfs can be expressed as a function of rotor position (*θ*) [17];

$$\begin{bmatrix} e\_a \\ e\_b \\ e\_c \end{bmatrix} = E \begin{bmatrix} f\_a(\theta) \\ f\_b(\theta) \\ f\_c(\theta) \end{bmatrix}, \quad (E = k\_e \omega) \tag{12}$$

where *ke* is back-emf constant, *fa* (*θ*)*, fb* (*θ*), and *fc* (*θ*) are the functions of rotor position as shown in Figure 8. In this study, *fa* (*θ*) trapezoidal function with limit values between +1 and -1 expressed by Eq.(13) has been employed.

$$f\_{\mathfrak{a}}(\Theta) = \begin{cases} (6/\pi)\Theta & (0 < \Theta \le \pi/6) \\ 1 & (\pi/6 < \Theta \le 5\pi/6) \\ -(6/\pi)\Theta + 6 & (5\pi/6 < \Theta \le 7\pi/6) \\ -1 & (7\pi/6 < \Theta \le 11\pi/6) \\ (6/\pi)\Theta - 12 & (11\pi/6 < \Theta \le 2\pi) \end{cases} \tag{13}$$

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 75

*i \**

*\* a*

current generator is compared with actual phase currents of the motor ( *abc i ,i ,i* ). These current error values ( *ia ib ic e ,e ,e* ) obtained using Eq. (17) are applied to inverter hysteresis band (±*hb*) and in regard to the switching states shown in Figure 8 (a), switching signals of

> *\* ia a a \* ib b b \* ic c c*

 

Inverter phase voltages (*vao, vbo, vco*) in reference to midpoint of DC supply voltage (*Vdc*) are

*V/ e h*

*V/ e h V/ e h*

*dc ib b*

*dc ib b*

*V/ e h V/ e h*

*V/ e h*

*dc ia b ao dc ia b*

 

*dc ic b co dc ic b*

BLDC motor phase voltages (*va, vb, vc*) are given in Eq. (19) related to inverter phase voltages

*a ao bo co*

*v (v v v )*

*b bo ao co*

*v (v v v )*

*c co ao bo*

*v (v v v )*

*bo*

*v*

*v*

*v*

*e ii e ii e ii*

0-30 0 *-I\* I\** 30-90 *I\* -I\** 0 90-150 *I\** 0 *-I\** 150-210 0 *I\* -I\** 210-270 *-I\* I\** 0 270-330 *-I\** 0 *I\** 330-360 0 *-I\* I\**

**Reference currents (A)**

*<sup>b</sup> <sup>i</sup> \**

*abc i ,i ,i* ) acquired from reference

(17)

(18)

(19)

*c i*

**Rotor position (***θ***-Degree)** 

**Table 2.** Reference currents of the BLDC motor

three-phase PWM inverter are generated [15,16].

obtained using Eq. (18) by using current error values.

In PWM current control block, reference phase currents ( *\*\*\**

**3.5. Current control block** 

determined from Eq. (18).

*fb* (*θ*) and *fc* (*θ*) can be determined in a similar way considering Figure 8. Substituting equations (12)-(13) into equation (11), the output torque expression becomes,

$$\mathbf{T}\_e = \mathbf{k}\_e \left( f\_a(\Theta) \mathbf{i}\_a + f\_b(\Theta) \mathbf{i}\_b + f\_c(\Theta) \mathbf{i}\_c \right) \tag{14}$$

## **3.3. Advanced simulation model of BLDC motor by using Runge-Kutta numerical integration method**

Runge-Kutta method is a frequently used method for solving differential equations numerically. In engineering solutions, fourth order Runge-Kutta method is the most widely used one [18]. For BLDC motor simulations, *ia*, *ib*, *ic*, *ω* and *θ* parameters, which have been given by Eqs. (8), (9) and (10) are calculated by using fourth order Runge-Kutta method. For example, the current associated with the a-phase (*ia*) is calculated using Eq. (15). Other parameters are calculated in the similar way.

$$\begin{aligned} k\_1 &= \frac{1}{L}(\upsilon\_a - R \, \dot{\imath}\_a(kT) - e\_a) \\ k\_2 &= \frac{1}{L}(\upsilon\_a - R \, \dot{\imath}\_a(kT) + \frac{k\_1}{2}) - e\_a) \\ k\_3 &= \frac{1}{L}(\upsilon\_a - R \, \dot{\imath}\_a(kT) + \frac{k\_2}{2}) - e\_a) \\ k\_4 &= \frac{1}{L}(\upsilon\_a - R \, \dot{\imath}\_a(kT) + k\_3) - e\_a) \\ \dot{\imath}\_a((k+1)T) &= \dot{\imath}\_a(kT) + \frac{T}{6}(k\_1 + 2 \, k\_2 + 2 \, k\_3 + k\_4) \end{aligned} \tag{15}$$

where *k* is the sample and *T* is the sampling period.

#### **3.4. Reference current generator**

Reference current generator determines reference phase currents ( *\*\*\* abc i ,i ,i* ) of the motor in regard to reference current amplitude (*I\** ), which is calculated using rotor position (*θ*). Reference current amplitude (*I\** ) can be obtained from Eq.(16).

$$\mathbf{I}^\* = \mathbf{u} \wedge \mathbf{k}\_t \tag{16}$$

where *u* is the control signal and *kt* is the torque constant. Phase currents given in Table 2 can be attained from Figure 8. These currents are input to PWM current control block [19].


**Table 2.** Reference currents of the BLDC motor

#### **3.5. Current control block**

74 Fuzzy Controllers – Recent Advances in Theory and Applications

*a*

**numerical integration method** 

parameters are calculated in the similar way.

1

1

1

*L*

1

1

*L*

*L*

*a a*

2

3

where *k* is the sample and *T* is the sampling period.

**3.4. Reference current generator** 

Reference current amplitude (*I\**

regard to reference current amplitude (*I\**

equations (12)-(13) into equation (11), the output torque expression becomes,

**3.3. Advanced simulation model of BLDC motor by using Runge-Kutta** 

4 3

Reference current generator determines reference phase currents ( *\*\*\**

*k (v R i (kT) e ) <sup>L</sup>*

*aa a*

*<sup>k</sup> k (v R ( i (kT) ) e )*

*<sup>k</sup> k (v R ( i (kT) ) e )*

*k (v R ( i (kT) k ) e )*

*aa a*

*aa a*

*aa a*

6 06 1 6 56 6 656 76 1 7 6 11 6 6 12 11 6 2

*(π / θ π / )*

*( π / θ π / )*

*e ea a b b c c T k (f ( <sup>θ</sup>)i f (θ)i f (θ)i )* (14)

(13)

(15)

*i ,i ,i* ) of the motor in

*abc*

), which is calculated using rotor position (*θ*).

*<sup>t</sup> I u/k* (16)

*( / π)θ ( θ π / )*

 

*f (θ) ( / π)θ ( π / θ π / )*

 

*fb* (*θ*) and *fc* (*θ*) can be determined in a similar way considering Figure 8. Substituting

Runge-Kutta method is a frequently used method for solving differential equations numerically. In engineering solutions, fourth order Runge-Kutta method is the most widely used one [18]. For BLDC motor simulations, *ia*, *ib*, *ic*, *ω* and *θ* parameters, which have been given by Eqs. (8), (9) and (10) are calculated by using fourth order Runge-Kutta method. For example, the current associated with the a-phase (*ia*) is calculated using Eq. (15). Other

1

2

2

2

1 2 2 6

*<sup>T</sup> i ((k )T) i (kT) (k k k k )*

) can be obtained from Eq.(16).

where *u* is the control signal and *kt* is the torque constant. Phase currents given in Table 2 can be attained from Figure 8. These currents are input to PWM current control block [19].

*\**

1 2 34

*( / π)θ ( π / θ π)*

In PWM current control block, reference phase currents ( *\*\*\* abc i ,i ,i* ) acquired from reference current generator is compared with actual phase currents of the motor ( *abc i ,i ,i* ). These current error values ( *ia ib ic e ,e ,e* ) obtained using Eq. (17) are applied to inverter hysteresis band (±*hb*) and in regard to the switching states shown in Figure 8 (a), switching signals of three-phase PWM inverter are generated [15,16].

$$\begin{aligned} e\_{ia} &= \dot{i}\_a^\* - \dot{i}\_a \\ e\_{ib} &= \dot{i}\_b^\* - \dot{i}\_b \\ e\_{ic} &= \dot{i}\_c^\* - \dot{i}\_c \end{aligned} \tag{17}$$

Inverter phase voltages (*vao, vbo, vco*) in reference to midpoint of DC supply voltage (*Vdc*) are obtained using Eq. (18) by using current error values.

$$\begin{aligned} \boldsymbol{\upsilon}\_{\rm ao} &= \begin{bmatrix} \boldsymbol{V}\_{\rm dc} \ \boldsymbol{\prime} \ \boldsymbol{2} & \boldsymbol{e}\_{\rm ia} \geq \boldsymbol{h}\_{\rm b} \\ -\boldsymbol{V}\_{\rm dc} \ \boldsymbol{\prime} \ \boldsymbol{2} & \boldsymbol{e}\_{\rm ia} \leq \boldsymbol{h}\_{\rm b} \end{bmatrix} \\ \boldsymbol{\upsilon}\_{\rm bo} &= \begin{bmatrix} \boldsymbol{V}\_{\rm dc} \ \boldsymbol{\prime} \ \boldsymbol{2} & \boldsymbol{e}\_{\rm ib} \geq \boldsymbol{h}\_{\rm b} \\ -\boldsymbol{V}\_{\rm dc} \ \boldsymbol{\prime} \ \boldsymbol{2} & \boldsymbol{e}\_{\rm ib} \leq \boldsymbol{h}\_{\rm b} \end{bmatrix} \\ \boldsymbol{\upsilon}\_{\rm co} &= \begin{bmatrix} \boldsymbol{V}\_{\rm dc} \ \boldsymbol{\prime} \ \boldsymbol{2} & \boldsymbol{e}\_{\rm ic} \geq \boldsymbol{h}\_{\rm b} \\ -\boldsymbol{V}\_{\rm dc} \ \boldsymbol{\prime} \ \boldsymbol{2} & \boldsymbol{e}\_{\rm ic} \leq \boldsymbol{h}\_{\rm b} \end{bmatrix} \end{aligned} \tag{18}$$

BLDC motor phase voltages (*va, vb, vc*) are given in Eq. (19) related to inverter phase voltages determined from Eq. (18).

$$\begin{aligned} \upsilon\_a &= \frac{1}{3}(2\upsilon\_{ao} - \upsilon\_{bo} - \upsilon\_{co}) \\ \upsilon\_b &= \frac{1}{3}(2\upsilon\_{bo} - \upsilon\_{ao} - \upsilon\_{co}) \\ \upsilon\_c &= \frac{1}{3}(2\upsilon\_{co} - \upsilon\_{ao} - \upsilon\_{bo}) \end{aligned} \tag{19}$$

## **4. Simulation results**

An algorithm has been developed to simulate the proposed real coded GA based fuzzy controller in BLDC motor drive. In all simulations and practical applications, the BLDC motor and inverter having the parameters listed in Table 3 have been used.

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 77

*R*13=*PB*

*a*1=1.3035, *b*1=1.0762, *c*1=0.2051 *a*2=1.5191, *b*2=2.9, *c*2=1.62

*R*1=*NB*, *R*2=*PM*, *R*3=*NS*, *R*4=*NB*, *R*5=*NB*, R6=*NM*, *R*7=*NS*, *R*8=*PM*, *R*9=*PB*, *R*10=*PB*, *R*11=*PS*, *R*12=*NM*,

**Fuzzy Controller Sequential Real Coded GA Simultaneous Real Coded GA Norm. Parameters** *n*1=642.348, *n*2=29.895, *n*3=3.144 *n*1=369.102, *n*2=8.448, *n*3=9.849

**Performance Index** *Jin*= 3.2349 (For 150 generations) *Jin*= 3.2327 (For 850 generations)

**Figure 9.** (a) Speed responses and, (b) Errors of conventional and GA based fuzzy controllers

based fuzzy control system are shown in Figure 10 (a) and 10 (b), respectively.

The convergence of performance index (*Jin*) for sequential and simultaneous real coded GA

**Figure 10.** Performance index of the (a) sequential, (b) simultaneous real coded GA based fuzzy control

In the sequential optimization method, the performance index (*Jin*) of the control system reduces to 3.2349 and this process completes in 150 generations using real coded GA. In the simultaneous optimization method, the performance index of the system (*Jin*) has been reduced to 3.2327. This is the best optimization value obtained in this study. The optimization process

*a*1=0.8488, *b*1=1.1002, *c*1=1.1309 *a*2=1.6005, *b*2=2.1, *c*2=1.5

*R*1=*NM*, *R*2=*PM*, *R*3=*NB*, *R*4=*NM*, *R*5=*Z*, *R*6=*NM*, *R*7=*Z*, *R*8=*PM*, *R*9=*Z*, *R*10=*PM*, *R*11=*PB*, *R*12=*NM*, *R*13 =*PM*

**Table 4.** Optimal design parameters of Real Coded GA based fuzzy controllers

**Parameters of Membership Func.** 

**Rule Base** 

system


**Table 3.** Parameters of the BLDC motor and Inverter

First of all, conventional fuzzy controller is designed based on trial-error method and simulation. The parameters of conventional fuzzy controller are obtained as; *n*1=10, *n*2=1, *n*3=2.2, *a*1=0.33, *a*2=0.66, *b*1=0.33, *b*2=0.66, *c*1=0.33, *c*2=0.66, *R*1=*NB*, *R*2=*NB*, *R*3=*NM*, *R*4=*NM*, *R*5=*NS*, *R*6=*NS*, *R*7=*Z*, *R*8=*PS*, *R*9=*PS*, *R*10=*PM*, *R*11=*PM*, *R*12=*PB*, *R*13=*PB*.

During simulation of sequential approach, normalization parameters, then rule base and the membership functions have been optimized sequentially. In this approach, the chosen values for mutation probability is 0.05, crossover probability is 0.8, population number is 20, the reference speed for the BLDC motor is set at 2000 rpm, and the motor operates in full load. In the second approach which uses simultaneous optimization, the process is implemented by coding all fuzzy controller parameters in GA simultaneously. In this approach, the chosen values for mutation probability is 0.1, crossover probability is 1, population number is 20, the reference speed for the BLDC motor is set at 2000 rpm and the motor operates in full load. The obtained design parameters of optimal fuzzy controllers using sequential and simultaneous real coded GA are given in Table 4.

For a reference speed of 2000 rpm and operating the BLDC motor in full load, the speed responses and error variations of conventional fuzzy control, sequential GA based fuzzy control and simultaneous GA based fuzzy control are shown in Figure 9 (a) and 9 (b), respectively.



**Table 4.** Optimal design parameters of Real Coded GA based fuzzy controllers

76 Fuzzy Controllers – Recent Advances in Theory and Applications

An algorithm has been developed to simulate the proposed real coded GA based fuzzy controller in BLDC motor drive. In all simulations and practical applications, the BLDC

First of all, conventional fuzzy controller is designed based on trial-error method and simulation. The parameters of conventional fuzzy controller are obtained as; *n*1=10, *n*2=1, *n*3=2.2, *a*1=0.33, *a*2=0.66, *b*1=0.33, *b*2=0.66, *c*1=0.33, *c*2=0.66, *R*1=*NB*, *R*2=*NB*, *R*3=*NM*, *R*4=*NM*,

During simulation of sequential approach, normalization parameters, then rule base and the membership functions have been optimized sequentially. In this approach, the chosen values for mutation probability is 0.05, crossover probability is 0.8, population number is 20, the reference speed for the BLDC motor is set at 2000 rpm, and the motor operates in full load. In the second approach which uses simultaneous optimization, the process is implemented by coding all fuzzy controller parameters in GA simultaneously. In this approach, the chosen values for mutation probability is 0.1, crossover probability is 1, population number is 20, the reference speed for the BLDC motor is set at 2000 rpm and the motor operates in full load. The obtained design parameters of optimal fuzzy controllers

For a reference speed of 2000 rpm and operating the BLDC motor in full load, the speed responses and error variations of conventional fuzzy control, sequential GA based fuzzy control and simultaneous GA based fuzzy control are shown in Figure 9 (a) and 9 (b),

motor and inverter having the parameters listed in Table 3 have been used.

**BLDC motor type Ametek 119003-01**

Rating (*P*) 106 watt Number of Phase (Connection) 3 (Star) Rated speed 4228 rpm. Rated current 6.8 A Stator equivalent resistance (*R*) 0.348 Ω Stator equivalent inductance (*L*) 0.314 mH Moment of inertia (*J*) 0.0019 Ncm-s2

Number of Pole (*p*) 8

**Table 3.** Parameters of the BLDC motor and Inverter

respectively.

Voltage constant (*ke*) 0.0419 V/rad/s Torque constant (*kt*) 4.19 Ncm/A PWM frequency (*fPWM*) 20 kHz Inverter DC supply (*Vdc*) 24 volt Inverter hysteresis limits (*hb*) ± 0.5 Inverter current limiter (*Ibase*) 20 A

*R*5=*NS*, *R*6=*NS*, *R*7=*Z*, *R*8=*PS*, *R*9=*PS*, *R*10=*PM*, *R*11=*PM*, *R*12=*PB*, *R*13=*PB*.

using sequential and simultaneous real coded GA are given in Table 4.

**4. Simulation results** 

**Figure 9.** (a) Speed responses and, (b) Errors of conventional and GA based fuzzy controllers

The convergence of performance index (*Jin*) for sequential and simultaneous real coded GA based fuzzy control system are shown in Figure 10 (a) and 10 (b), respectively.

**Figure 10.** Performance index of the (a) sequential, (b) simultaneous real coded GA based fuzzy control system

In the sequential optimization method, the performance index (*Jin*) of the control system reduces to 3.2349 and this process completes in 150 generations using real coded GA. In the simultaneous optimization method, the performance index of the system (*Jin*) has been reduced to 3.2327. This is the best optimization value obtained in this study. The optimization process with simultaneous GA completes in 850 generations. Also, the performance index value indicates that simultaneous optimization process gives better results than the sequential optimization process. However, while the overall controller is optimized in 150 generations in sequential optimization method, the optimization is completed in 850 generations in simultaneous approach, in which all parameters are optimized simultaneously.

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 79

In the experimental study, sensorless control of the BLDC motor was implemented successfully using conventional fuzzy controller, sequential and simultaneous real coded GA based fuzzy controller, which have parameters obtained by simulation and given in Table 4. Optimal fuzzy controller was implemented in high level C programming language; the program was compiled by VisualDSP++ C compiler and downloaded to the ADSP-21992 DSP controller board. The block diagram of the configuration of closed loop speed control of BLDC motor executed without position and speed sensors is illustrated in Fig 11(a). The experimental setup implemented in the laboratory is shown in Fig 11(b). The reference speed for BLDC motor is set at 2000 rpm, and the motor operates in full load similar with

In Figure 12, phase to phase voltage and phase current waveforms of BLDC motor are shown. The responses of both conventional and sequential real coded GA based fuzzy controller are shown in Figure 13, conventional fuzzy and simultaneous real coded GA based fuzzy controller are shown in Figure 14, sequential real coded GA based fuzzy and simultaneous real coded GA based fuzzy controller are shown in Figure 15,

The experimental results illustrated in these figures prove that the BLDC motor control system was implemented successfully and it operates stably. Also, it is indicated that

**Figure 12.** Phase to phase voltage and phase current of the BLDC motor. Time/Div:2.50msec,

Volt/Div:20.0V(CH1), Amper/Div:2.00A(CH2)

simulation results show agreement with experimental results.

the simulations.

respectively.

## **5. Experimental results**

Block diagram of the configuration of DSP based experimental system is shown in Figure 11. The experimental system consist of a brushless DC motor, a voltage source inverter, a current detector for hysteresis current control loop, back-emf detector for sensorless speed control loop, ADSP-21992 Ez-Kit Lite evaluation board, interface devices between ADSP and driver board, a PC and VisualDSP++ software for emulating and programming the DSP.

**Figure 11.** (a) Block diagram, (b) an overview picture of experimental setup of BLDC motor control systems

In the experimental study, sensorless control of the BLDC motor was implemented successfully using conventional fuzzy controller, sequential and simultaneous real coded GA based fuzzy controller, which have parameters obtained by simulation and given in Table 4. Optimal fuzzy controller was implemented in high level C programming language; the program was compiled by VisualDSP++ C compiler and downloaded to the ADSP-21992 DSP controller board. The block diagram of the configuration of closed loop speed control of BLDC motor executed without position and speed sensors is illustrated in Fig 11(a). The experimental setup implemented in the laboratory is shown in Fig 11(b). The reference speed for BLDC motor is set at 2000 rpm, and the motor operates in full load similar with the simulations.

78 Fuzzy Controllers – Recent Advances in Theory and Applications

**5. Experimental results** 

systems

with simultaneous GA completes in 850 generations. Also, the performance index value indicates that simultaneous optimization process gives better results than the sequential optimization process. However, while the overall controller is optimized in 150 generations in sequential optimization method, the optimization is completed in 850 generations in

Block diagram of the configuration of DSP based experimental system is shown in Figure 11. The experimental system consist of a brushless DC motor, a voltage source inverter, a current detector for hysteresis current control loop, back-emf detector for sensorless speed control loop, ADSP-21992 Ez-Kit Lite evaluation board, interface devices between ADSP and driver board, a PC and VisualDSP++ software for emulating and programming the DSP.

**Figure 11.** (a) Block diagram, (b) an overview picture of experimental setup of BLDC motor control

simultaneous approach, in which all parameters are optimized simultaneously.

In Figure 12, phase to phase voltage and phase current waveforms of BLDC motor are shown. The responses of both conventional and sequential real coded GA based fuzzy controller are shown in Figure 13, conventional fuzzy and simultaneous real coded GA based fuzzy controller are shown in Figure 14, sequential real coded GA based fuzzy and simultaneous real coded GA based fuzzy controller are shown in Figure 15, respectively.

The experimental results illustrated in these figures prove that the BLDC motor control system was implemented successfully and it operates stably. Also, it is indicated that simulation results show agreement with experimental results.

**Figure 12.** Phase to phase voltage and phase current of the BLDC motor. Time/Div:2.50msec, Volt/Div:20.0V(CH1), Amper/Div:2.00A(CH2)

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 81

**Figure 15.** Speed responses of sequential and simultaneous Real Coded GA based fuzzy controller.

Although real coded genetic algorithm based fuzzy controller has shown a good behaviour for sensorless speed control of a Brushless DC Motor, we think that there are some

 Like other artificial intelligence techniques, the genetic algorithm cannot assure constant optimisation response times. Even more, the difference between the shortest and the longest optimisation response time is much larger than with conventional gradient methods. This unfortunate genetic algorithm property limits the genetic

 Genetic algorithm applications in controls which are performed in real time are limited because of random solutions and convergence, in other words this means that the entire population is improving, but this could not be said for an individual within this population. Therefore, it is unreasonable to use genetic algorithms for on-line controls

 For the design of an effective controller, simulation model of the system is necessary to obtain the most accurately. However, even if the best controller have been designed in

in real time systems without testing them first on a simulation model.

Time/Div:250 msec, Volt/Div:400 rpm.

**6. Limitations of the proposed methods** 

algorithms' use in real time applications.

limitations and disadvantages as follows in proposed method.

**Figure 13.** Speed responses of sequential and conventional fuzzy control of the BLDC motor. Time/Div:250 msec, Volt/Div:400 rpm.

**Figure 14.** Speed responses of simultaneous and conventional fuzzy control of the BLDC motor. Time/Div:2.50 msec, Volt/Div:400 rpm.

**Figure 15.** Speed responses of sequential and simultaneous Real Coded GA based fuzzy controller. Time/Div:250 msec, Volt/Div:400 rpm.

## **6. Limitations of the proposed methods**

80 Fuzzy Controllers – Recent Advances in Theory and Applications

Time/Div:250 msec, Volt/Div:400 rpm.

Time/Div:2.50 msec, Volt/Div:400 rpm.

**Figure 13.** Speed responses of sequential and conventional fuzzy control of the BLDC motor.

**Figure 14.** Speed responses of simultaneous and conventional fuzzy control of the BLDC motor.

Although real coded genetic algorithm based fuzzy controller has shown a good behaviour for sensorless speed control of a Brushless DC Motor, we think that there are some limitations and disadvantages as follows in proposed method.


simulation environment, fine tuning may be require in order to use the same controller in on-line system.

Design of a Real Coded GA Based Fuzzy Controller for Speed Control of a Brushless DC Motor 83

[1] F. Cupetino, V. Giordano, D. Naso, B. Turchiano, L. Salvatore (2003) On-Line Genetic Design of Fuzzy Controllers for DC Drives with Variable Load. IEE Electronics Letters,

[2] G. Acosta, E. Todorovich (2003) Genetic Algorithm and Fuzzy Control: A Practical Synergism for Industrial Applications. Elsevier Science Direct, Computer in Industry,

[3] O. Aydogdu (2006) Sensorless Control of Brushless DC Machines by means of Genetic

[4] F. Ashrafzadeh, E.P. Nowicki, M. Mohammadian, J.S. Salmon (1996) An Effective Approach for Optimal Design of Fuzzy Controllers. IEEE Canadian Conference on

[5] C. Xia, P. Guo, T. Shi, M. Wang (2004) Speed control of brushless dc motor using genetic algorithm based fuzzy controller. Proc. of Int. Conf. on Intelligent Mechatronics and

[6] H.P. Stpathy (2003) Real Coded for Parameters Optimization in Short-Term Load

[7] N. Hemati, M.C. Leu (1992) A complete model characterization of brushless dc motors.

[8] O. Aydogdu, R. Akkaya (2005) DSP Based Fuzzy Control of a Brushless DC Motor Without Position and Speed Sensors. Proceedings of 4th International Advanced

[9] C.K Lee, W.H. Pang (1994) A Brushless DC Motor Speed Control System Using Fuzzy

[10] V. Donescu, D.O. Neacsu, G. Griva, F. Profumo (1996) A Systematic Design Method for Fuzzy Controller for Brushless DC Motor Drives. Proc. of the 27th. IEEE Annual Power

[11] M. Çunkaş, R. Akkaya (2002) Compare with Binary and Real Coded Genetic Algorithms. Selcuk University The Journal of Engineering, Vol. 7 (2), pp. 11-17. [12] C.J. Wu, G.Y. Liu (200) A Genetic Approach for Simultaneous Design of Membership Functions and Fuzzy Control Rules. Kluwer Academic Pub. Journal of Intelligent and

[13] N.J. Radcliff (1991) Formal Analysis and Random Respectful Recombination. In Proc. of Fourth International Conference on Genetic Algorithms, San Diego, CA, USA. [14] R.L. Haupt, S. Haupt (1998) Practical Genetic Algorithms, A Willey-Interscience

[15] B. Lee, M. Ehsani (2003) Advanced Simulation Model for Brushless DC Motor Drives. Taylor & Francis Inc. Electric Power Component and Systems, Vol. 31, pp. 841-868. [16] H.A. Toliyat, T. Gopalarathnam (2002) AC Machines Controlled as DC Machines (Brushless DC Machines/Electronics). In: L.S. Timothyl, (eds) The Power Electronic

Based Fuzzy Controller. PhD. Thesis, Selcuk University, Turkey.

Electrical and Computer Engineering, pp. 542-545, Alberta, Canada.

Forecasting. Springer-Verlag Berlin Heidelberg IWANN, pp. 417-124.

IEEE Transactions on Industry Applications, Vol. 28 (1), pp. 172-180.

Rules. IEE Power Electronics and Variable Speed Drives, pp. 101-106.

Electronics Specialists Conference, pp. 689-694, Baveno, İtaly.

Technologies Symposium, pp. 182-187, Konya, Turkey.

Automation, pp. 460-464, Chengdu, Chine.

Robotic Systems, Vol. 28, pp. 195-211.

Handbook. CRC Press LLC, New York, pp. 78-100.

Publication, USA.

**8. References** 

Vol. 39 (5), pp. 479-480.

Vol. 52, pp. 183-195.


## **7. Conclusions**

As a result of the study, optimal fuzzy controller has been designed off-line by using real coded GA and the obtained fuzzy controller has been used on-line for DSP-based BLDC motor control system. Modeling of the BLDC motor was performed more accurately to take account of trapezoidal back-emf waveforms and furthermore, fourth order Runge-Kutta numerical integration method was used to decrease the truncation error and numerical instabilities in simulation. Also, the results of our research indicate that an improvement in the transient state and steady state responses of the system has been obtained by means of optimization process using real coded GA. It is clear that, sequential optimization takes less time. Also, observing the system speed response and error curves, it can be deduced that the sequential method gives satisfactory results and that it can be preferred in applications. It was observed that the use of real coded GA makes it possible to adjust system parameters more precisely. Also, the size of chromosomes, in which a great deal of parameters is coded, is reduced. Besides, the proposed method limits the process time to minutes.

## **Author details**

Omer Aydogdu and Ramazan Akkaya *Department of Electrical and Electronics Engineering, Faculty of Engineering and Architecture, Selcuk University, Konya, Turkey* 

## **Acknowledgement**

This study was supported by Selcuk University Scientific Research Projects (BAP) Support Fund under contract number 2003/051.

## **8. References**

82 Fuzzy Controllers – Recent Advances in Theory and Applications

in on-line system.

electronics.

**7. Conclusions** 

process time to minutes.

**Acknowledgement** 

Omer Aydogdu and Ramazan Akkaya

Fund under contract number 2003/051.

*Department of Electrical and Electronics Engineering,* 

*Faculty of Engineering and Architecture, Selcuk University, Konya, Turkey* 

This study was supported by Selcuk University Scientific Research Projects (BAP) Support

**Author details** 

line system for fine tuning.

simulation environment, fine tuning may be require in order to use the same controller

Micro genetic algorithm which can produce near optimal solution may be used in on-

 It is not possible to show the stability of the fuzzy controlled system, since the model is not known. If the system model is obtained exactly, the use of tradional gradient

 The advantage of sensorless BLDC motor control is that the sensing part can be omitted, and thus overall costs can be considerably reduced. In addition, the disadvantages of sensorless control are higher requirements for control algorithms and more complicated

As a result of the study, optimal fuzzy controller has been designed off-line by using real coded GA and the obtained fuzzy controller has been used on-line for DSP-based BLDC motor control system. Modeling of the BLDC motor was performed more accurately to take account of trapezoidal back-emf waveforms and furthermore, fourth order Runge-Kutta numerical integration method was used to decrease the truncation error and numerical instabilities in simulation. Also, the results of our research indicate that an improvement in the transient state and steady state responses of the system has been obtained by means of optimization process using real coded GA. It is clear that, sequential optimization takes less time. Also, observing the system speed response and error curves, it can be deduced that the sequential method gives satisfactory results and that it can be preferred in applications. It was observed that the use of real coded GA makes it possible to adjust system parameters more precisely. Also, the size of chromosomes, in which a great deal of parameters is coded, is reduced. Besides, the proposed method limits the

descent methods may give better result for optimal control in on-line systems. In fuzzy control systems, computing time could be long, because of the complex operations such as fuzzifications and particularly defuzzification. So, the fuzzy

controller hardware requires high-speed processors, such as DSP, FPGA.

	- [17] B. Sing, K. Jain (2003) Implementation of DSP based digital speed controller for permanent magnet brushless dc motor. IE(I) Journal-EL., Vol. 84, pp. 16-21.

**Chapter 4** 

© 2012 Zarandi et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

© 2012 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution,

**A Type-2 Fuzzy Model Based on Three** 

**Dimensional Membership Functions for** 

**Smart Thresholding in Control Systems** 

M.H. Fazel Zarandi, Fereidoon Moghadas Nejad and H. Zakeri

membership values by using flexible thresholding for controller problems.

This chapter focuses on the basic concepts of novel fuzzy sets, three dimensional (3D) memberships and how they are applied in the design of type-1 and type-2 fuzzy thresholding in control systems. Automatic fuzzification and membership functions shape selection play a crucial role in fuzzy thresholding design and finally determination of outputs via defuzzification. The related methodology and theoretical base will be discussed in depth, using real examples in automatic control (Pavement distress detection and classification). In spatial domain, selection of membership functions is a difficult task. It should be noted that selection of a supper membership function is a golden key. This is one of the major aims of this chapter to introduce a robust method to consider the uncertainty of

In direct approach to fuzzy modeling, deep knowledge of expert plays a key role for membership functions generation. In application, ambiguity of membership function assignment is the main problem with fuzzy sets and systems. So, different fuzzy membership functions may have various impacts on the systems and, then, different

To solve this problem, type II fuzzy thresholding is recommended. The upper and lower membership functions promote this dilemma; however the figure of uncertainty (FOU) has a fixed value that is equal to one, in upper and lower membership function. So, Type-2 fuzzy logic can effectively improve the control characteristics using FOU of the membership

In this chapter, a smart thresholding technique with its application will be presented, which processes threshold as flexible type-2 fuzzy sets. The concept of ultra-fuzziness aims at

and reproduction in any medium, provided the original work is properly cited.

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/47798

thresholds in control problems.

functions.

**1. Introduction** 

