Application of Improved PID Controller in Motor Drive System

PID (proportional-integral-derivative) controller has being widely used in motor drive system. More than 90% of industrial controllers are implemented based on PID algorithms (Ang et al., 2005). The structure of PID controller is very simple and its control principle is very clear. It is practical and is very easy to be implemented. What’s more, because the functionalities of the three factors in PID controller are very clear, they can be tuned efficiently to obtain desired transient and steady-state responses. Motor drive systems can be found in many applications, their behaviours can influence the performances of the whole system tremendously. The motor drive system has many distinct features, such as multivariable, strong nonlinearity and strong coupling (Li et al., 2010). Many parameters in the system are time-variant. What’s more, in many cases, it’s very difficult to get the accurate mathematical model of the motor drive system. All these features make the control of the motor drive system difficult. PID controller is very popular in the control of the motor drive system. However, since the controller parameters are fixed during control after they have been chosen through a certain optimal method, the conventional PID controller can’t always keep satisfying performances. To cope with this problem, the parameters of the controller need to be adjusted dynamically according to the running status of the system. Many on-line tuning algorithms, such as fuzzy logic, neural network and genetic algorithm, have been introduced into PID controller to achieve desired control performances for the entire operating envelope of the motor drive system (Tang et al., 2001; Yu et al., 2009; Lin et al., 2003). In this chapter, two improved self-tuning PID controllers are given and studied in detail. To verify their validity, two typical motor drive systems, namely switched reluctance motor (SRM) drive system (Chen & Gu, 2010) and brushless DC motor (BLDCM) drive system (Wu et al., 2005), are introduced as examples. Based on the models of these two drive systems, the performances of the improved PID controllers are analyzed in detail.


Introduction
PID (proportional-integral-derivative) controller has being widely used in motor drive system. More than 90% of industrial controllers are implemented based on PID algorithms (Ang et al., 2005). The structure of PID controller is very simple and its control principle is very clear. It is practical and is very easy to be implemented. What's more, because the functionalities of the three factors in PID controller are very clear, they can be tuned efficiently to obtain desired transient and steady-state responses. Motor drive systems can be found in many applications, their behaviours can influence the performances of the whole system tremendously. The motor drive system has many distinct features, such as multivariable, strong nonlinearity and strong coupling . Many parameters in the system are time-variant. What's more, in many cases, it's very difficult to get the accurate mathematical model of the motor drive system. All these features make the control of the motor drive system difficult. PID controller is very popular in the control of the motor drive system. However, since the controller parameters are fixed during control after they have been chosen through a certain optimal method, the conventional PID controller can't always keep satisfying performances. To cope with this problem, the parameters of the controller need to be adjusted dynamically according to the running status of the system. Many on-line tuning algorithms, such as fuzzy logic, neural network and genetic algorithm, have been introduced into PID controller to achieve desired control performances for the entire operating envelope of the motor drive system (Tang et al., 2001;Yu et al., 2009;Lin et al., 2003). In this chapter, two improved self-tuning PID controllers are given and studied in detail. To verify their validity, two typical motor drive systems, namely switched reluctance motor (SRM) drive system (Chen & Gu, 2010) and brushless DC motor (BLDCM) drive system (Wu et al., 2005), are introduced as examples. Based on the models of these two drive systems, the performances of the improved PID controllers are analyzed in detail.

Conventional PID Controller
In analog control system, PID controller is used commonly. The conventional PID (C-PID) controller is a linear control method. It compounds the outputs of proportional, integral and derivative parts linearly to control the system. Fig. 1 shows the block diagram of the C-PID controller.
The algorithm of C-PID controller can be given as follows: ( 2) where y(t) is the output of the system, r(t) is the reference input of the system, e(t) is the error signal between y(t) and r(t), u(t) is the output of the C-PID controller, K p is proportional gain, T i is integral time constant and T d is derivative time constant. Equation (2) also can be rewritten as (3): where K i is integral gain, K d is derivative gain, and K i =K p /T i , K d =K p T d . In C-PID controller, the relation between PID parameters and the system response specifications is clear. Each part has its certain function as follows (Shi & Hao, 2008): (1) Proportion can increase the response speed and control accuracy of the system. Bigger K p can lead to faster response speed and higher control accuracy. But if K p is too big, the overshoot will be large and the system will tend to be instable. Meanwhile, if K p is too small, the control accuracy will be decreased and the regulating time will be prolonged. The static and dynamic performance will be deteriorated.
(2) Integration is used to eliminate the steady-state error of the system. With bigger K i , the steady-state error can be eliminated faster. But if K i is too big, there will be integral saturation at the beginning of the control process and the overshoot will be large. On the other hand, if K i is too small, the steady-state error will be very difficult to be eliminated and the control accuracy will be bad. (3) Differentiation can improve the dynamic performance of the system. It can inhibit and predict the change of the error in any direction. But if K d is too big, the response process will brake early, the regulating time will be prolonged and the anti-interference capability of the system will be bad. www.intechopen.com The three gains of C-PID controller, K p , K i and K d , can be determined conveniently according to the above mentioned function of each part. There are many methods such as NCD (Wei, 2004;Qin et al., 2005) and genetic algorithm can be used to determine the gains effectively.
(1) NCD is a toolbox in Matlab. It is developed for the design of nonlinear system controller. On the basis of graphical interfaces, it integrates the functions of optimization and simulation for nonlinear system controller in Simulink mode.
(2) Genetic algorithm (GA) is a stochastic optimization algorithm modeled on the principles and concepts of natural selection and evolution. It has outstanding abilities for solving multi-objective optimization problems and finding global optimal solutions. GA can readily handle discontinuous and nondifferentiable functions. In addition, it is easily programmed and conveniently implemented (Naayagi & Kamaraj, 2005;Vasconcelos et al., 2001). In many conventional applications, the gains of C-PID controller are determined offline by one of the methods mentioned above and then fixed during the whole control process. This control scheme has two obvious shortcomings as follows: (1) All the methods that can be used to determine the gains of C-PID controller offline are based on the precise mathematical model of the controlled system. However, in many applications, such as motor drive system, it is very difficult to build the precise mathematical model due to the multivariable, time-variant, strong nonlinearity and strong coupling of the real plant.
(2) In many applications, some parameters of the controlled system are not constant. They will be changed according to different operation conditions. For example, in motor drive system, the winding resistance of the motor will be changed nonlinearly along with the temperature. If the gains of C-PID controller are still fixed, the performance of the system will deteriorate. To overcome these disadvantages, C-PID should be improved. The gains of PID controller should be adjusted dynamically during the control process.

Improved PID Controller
There are many techniques such as fuzzy logic control, neural network and expert control (Xu et al., 2004) can be adopted to adjust the gains online according to different conditions. In this chapter, two kinds of Improved PID (I-PID) controller based on fuzzy logic control and neural network are studied in detail.

Fuzzy Self-tuning PID Controller
Fuzzy logic control (FLC) is a typical intelligent control method which has been widely used in many fields, such as steelmaking, chemical industry, household appliances and social sciences. The biggest feature of FLC is it can express empirical knowledge of the experts by inference rules. It does not need the mathematical model of the controlled object. What's more, it is not sensitive to parameters changing and it has strong robustness. In summary, FLC is very suitable for the controlled object with characteristics of large delay, large inertia, non-linear and time-variant (Liu & Li, 2010;Liu & Song, 2006;Shi & Hao, 2008). The structure of a SISO (single input single output) FLC is shown in Fig. 2. It can be found that the typical FLC consists of there main parts as follows: www.intechopen.com (2) Fuzzy Inference Machine is the core of a fuzzy control system. It combines the facts obtained from the fuzzification with the rule base and conducts the fuzzy reasoning process. A proper rule base can be found either by asking experts or by evaluation of measurement data using data mining methods. (3) Defuzzification transforms an output fuzzy set back to a crisp value. Many methods can be used for defuzzification, such as centre of gravity method (COG), centre of singleton method (COS) and maximum methods. Detailed analyses show that FLC is a nonlinear PD controller. It cannot eliminate steadystate error when the controlled object does not have integral element, so it is a ragged controller. To overcome this disadvantage, FLC is often used together with other controllers. Fig. 3 shows the structure of a controller called Fuzzy_PID compound controller. When the error is big, FLC is used to accelerate the dynamic response, and when the error is small, PID controller is used to enhance the steady-state accuracy of the system (Liu & Song, 2006).  In this chapter, an I-PID controller called fuzzy self-tuning PID (FPID) controller is introduced. In this controller, FLC is used to tune the parameters of C-PID controller online according to different conditions. Fig. 4 shows the structure of FPID controller (Liu & Li, 2010). In FPID controller, the error signal and the rate of change of error are inputted into FLC firstly. After fuzzy inference based on the rule base, the increments of PID control parameters, ∆K p , ∆K i and ∆K d , are obtained, add these increments to initial values of PID control parameters, the actual PID control parameters can be achieved finally. The initial values of PID control parameters, K p0 , K i0 and K d0 , can be obtained by the methods mentioned in the last section.

Neural Network PID Controller
Neural network (NN) is a mathematical model or computational model inspired by the structure and functional aspects of biological neural systems, such as the brain. It is composed of a large number of highly interconnected processing elements (neurones) working in unison to solve specific problems. Fig. 5 shows the typical structure of a NN. It has one input layer, one output layer and several hidden layers. In each layer, there are a certain number of nodes (neurons). The neurons in adjacent layers are connected together, while there are no connections between neurons in the same layer. Just like the biological neural systems, the NN also can learn by itself. During the learning phase, the connection strength (weights) between neurons can be adjusted by certain algorithms automatically based on external or internal information that flows through the network. (Tao, 2002;Liu, 2003;Wang et al., 2007) Input layer Hidden layers Output layer The greatest advantage of NN is its ability to be used as an arbitrary function approximation mechanism which 'learns' from observed data. There are many other remarkable advantages of NN as follows: (1) Adaptive learning: An ability to learn how to do tasks based on the data given for training or initial experience.
(2) Real time operation: NN can process massive data and information in parallel. Special hardware devices are being designed and manufactured which take advantage of this capability.
(3) Fault tolerance: Some capabilities of NN can be retained even with major network damage.
BP (backpropagation) neural network (BPNN) is the most popular neural network for practical applications. It adopts the backpropagation learning algorithm which can be divided into two phases: data feedforward and error backpropagation.
(1) Data feedforward: In this phase, the data, such as the error of the controlled system, inputted into the input layer is fed into the hidden layer and then into the output layer. Finally, the output of the BPNN can be obtained from the output layer. It is the function of the connection weights between neurons.
(2) Error backpropagation: In this phase, the actual output value of the network obtained in the last phase is compared with a desired value. The error between them is propagated backward. The connection weights between neurons are adjusted by some means, such as gradient descent algorithm, based on the error. These two phases are repeated continuously until the performance of the network is good enough. In this chapter, BPNN is used to tune the parameters of C-PID controller online. Fig. 6 shows the structure of this I-PID controller named NNPID controller. It can be seen that NNPID controller consists of C-PID controller and BPNN. C-PID controller is used to control the plant directly. Its output, u(t), can be obtained by (3). In order to optimize the performance of the system, BPNN is used to adjust the three parameters of C-PID controller online based on some state variables of the system.

Motor Drive System
Motor is the main controlled object in motor drive system. In practical applications, there are many kinds of motors. In this chapter, the brushless DC motor (BLDCM) and switched reluctance motor (SRM) are studied as examples. Their mathematical models are built to simulate the performance of different control methods.

Brushless DC Motor
In BLDCM, electronic commutating device is used instead of the mechanical commutating device. Because BLDCM has many remarkable advantages, such as high efficiency, silent operation, high power density, low maintenance, high reliability and so on, it has been widely used in many industrial and domestic applications.
The voltage equation for one phase in BLDCM can be written as: where u, i a , R a and L a are the voltage, current, resistance and inductance of one phase, respectively. e is the back EMF (electromotive force) which can be calculated by where ω is the angular speed of the rotor, k v is a constant which can be calculated by where C e is the EMF constant and Ф is the flux per pole. The torque equation can be given as where T em is electromagnetic torque, T L is load torque, B is damping coefficient and J is rotary inertia. T em also can be obtained by where k t is a constant which can be calculated by where C T is the torque constant. Based on all above equations, the state space equation of BLDCM can be obtained as The Laplace transform of (10) can be written as two equations as follows:

Switched Reluctance Motor
The SRM is a brushless synchronous machine with salient rotor and stator teeth. There are concentrated phase windings in the stator, and no magnets and windings in the rotor. It has many remarkable advantages such as simple magnetless and rugged construction, simple control, ability of extremely high speed operation, relatively wide constant power capability, minimal effects of temperature variations offset, low manufacturing cost and ability of hazard-free operation. These advantages make the SRM very suitable for applications in more/all electric aircraft (M/A EA), electric vehicle (EV) and wind power generation. Because the nonlinear model of SRM is very complex, people generally use its quasi-linear model to design and analyze control methods. According to the quasi-linear model of SRM, the average torque equation can be obtained as (12) when the phase current is flat topped (Wang, 1999 where T av is the average torque, m is the number of motor phase, N r is the number of rotor tooth, U s is the power supply voltage, ω r is angular speed of the rotor, θ on is the angle of starting the excitation, θ off is the angle of switching off the excitation, θ 1 is the starting angle of the phase inductance increasing, L max and L min are the maximum and minimum value of phase inductance, respectively. Based on (12), the total differential equation of T av can be written as (He et al., 2004) According to the linearization theory, the differential of each variable in (13) can be replaced by corresponding increment. If voltage PWM control is adopted, θ on and θ off are fixed. The simplified small-signal torque equation can be obtained as www.intechopen.com The increment of the average torque also can be indicated as The voltage chopping can be treated as a sampling process of the controller's output ∆UASR, and the amplification factor is K c . The small-signal model of power inverter can be given as The feedback of angular speed can be treated as a small inertial element.
where K n is feedback coefficient and T ω is time constant of the measurement system. Based on above analysis, the simplified small-signal model of SRM can be got as shown in Fig. 8.

FPID Controller for SRM
Based on Fig.1, Fig. 4 and Fig. 8, the simulation model of C-PID and FPID for SRM can be obtained as shown in Fig. 9 and Fig. 10. The internal structure of the module marked "SRM" is the part that enclosed by dashed box in Fig. 8. It can be found that the three parameters of the PID controller in FPID control can be obtained by Where K p0 , K i0 and K d0 are the initial PID parameters obtained by NCD or GA. ∆K p , ∆K i and ∆K d are provided by FLC. They are used to adjust the three parameters online. In other words, the parameters of C-PID can be dynamically tuned by FLC according to different operation conditions. Fig. 11 shows the structure of the FLC used in FPID controller. It has two input variables and three output variables. The most important thing for the design of FPID controller is the determination of the fuzzy rule base. According to the functions of each PID parameter mentioned in section 2, the principles for their adjustment can be summarized as follows (Shi & Hao, 2008): (1) When the absolute value of the system error,│e(t)│, is relatively big: K p is increased to get faster tracking speed, K i is reduced to avoid overshoot. (2) When │e(t)│ is relatively small: K p and K i are increased to enhance the tracking precision, K d should be proper to avoid steady-state oscillation.
(3) When │e(t)│ is medium: K p is reduced to avoid overshoot, K i is increased slightly to enhance the steady-state precision, and K d should be proper to guarantee the stability of the system. Based on above principles and consider the change rate of the system error, ec(t), the fuzzy rule base of the three parameters can be obtained. As an example, It can be seen that there are totally 49 fuzzy rules and they are represented by fuzzy linguistic terms, such as if e=NB and ec=NB then ∆K p =NB, ∆K i =NB, ∆K d =PB.
In this chapter, all the variables are described by seven linguistic terms. They are negative big (NB), negative middle (NM), negative small (NS), zero (ZO), positive small (PS), positive middle (PM) and positive big (PB). The universe of input variables, e and ec, is {-3 -2 -1 0 1 2 3}. The universe of output variables, ∆K p , ∆K i and ∆K d , is {-0.6 -0.4 -0.2 0 0.2 0.4 0.6}. Fig. 12 and 13 show the membership function of each variable.  In this chapter, the MAX-MIN method is used for fuzzy inference and centroid is used for defuzzification.

NNPID Controller for BLDCM
Based on Fig.1 and Fig. 7, the simulation model of C-PID for BLDCM can be obtained as shown in Fig. 14. The internal structure of the module marked "BLDCM" is the part that enclosed by dashed box in Fig. 7. It can be seen that the adopted BPNN has three layers: one input layer, one hidden layer and one output layer. There are three input variables and three output variables. r(k) is the reference input of the system, y(k) is the real output of the system and e(k) is the error between them. K p , K i and K d are the three parameters of the C-PID controller. There are five nodes (neurones) in the hidden layer. During operation, the connection strength (weights) between neurons can be adjusted automatically through learning based on the input information. The three output variables of NN, K p , K i and K d , will be changed along with the adjustment of the connection weights. Finally, the performance of the system can be improved. The output of nodes in input layer equals to their input. The input and output of nodes in hidden layer and output layer can be represented as (Liu, 2003) where   2 ij w is connection weight between input and hidden layer,   3 li w is connection weight between hidden and output layer, f [·] and g [·] are activation functions. In this chapter, the activation function of hidden layer is sigmoid function. Because the output variables of NN, K p , K i and K d , can't be negative, the activation function of output layer is nonnegative sigmoid function, that is In this chapter, the output variables of NN are the three parameters of C-PID controller, that is With (19) ~ (22), NN completes the feedforward of the information. The output of the C-PID controller can be got easily based on the three updated parameters, and then the output of the system, y(k), can be obtained. The next step is the backpropagation of the error. To minimize the error between y(k) and r(k), a performance index function is introduced as Typically, the connection weights are adjusted by steepest descent method. To increase the convergence speed, an inertia term is added.
where η is learning rate, is inertia coefficient. In this chapter, η=0.001 and α=0.05. Based on (19) ~ (24), the connection weights can be tuned dynamically. In this chapter, the NNPID controller for BLDCM is implemented by M-File in Matlab.
The initial values of the three parameters in C-PID are K p =5, K i =7, K d =2. Fig. 16 shows the step response of the SRM with C-PID and FPID controller, respectively. The reference angular speed is 100rad/s. The motor is started without load, and at 10s a 50Nm load is added. It can be seen that compared with C-PID controller, the FPID controller can improve the performance of the system significantly. It has advantages of no overshoot, shorter adjusting time. Moreover, when add load torque suddenly at 10s, the drop of the angular speed is smaller and the transition time is shorter.
www.intechopen.com It can be found that during the adjustment process of the angular speed, the three parameters are tuned dynamically as well. When the system reaches its steady-state, the angular speed is constant and the three parameters are also changed into their initial values.

NNPID Controller for BLDCM
The discrete form of the BLDCM used in this chapter is u(k-1) . y(k-2) . y(k-1) . y(k)       058 3 102 0 417 0 where u is the output of the C-PID controller.  Fig. 19. The adjustment of K p , K i and K d in NNPID controller Fig. 18 shows the step response of the BLDCM with C-PID and NNPID controller, respectively. The reference angular speed is 10rad/s. The motor is started without load. It can be seen that compared with C-PID controller, the NNPID controller can improve the performance of the system significantly. The overshoot of the system is nearly eliminated. However, because NNPID controller needs time to train NN, the adjusting times of the system with two controllers are almost the same. Fig. 19 shows the adjustment of the three parameters, K p , K i and K d , in NNPID controller. It can be found that during the adjustment process of the angular speed, the three parameters are tuned dynamically. When the system reaches its steady-state, the angular speed is constant and the three parameters are constant as well.

Conclusion
In this chapter, the structure and operation principle of C-PID controller are introduced firstly. According to the shortcomings of C-PID controller, two improved PID controllers, namely FPID and NNPID controller, are studied. The structure and operation principle of them are analyzed. Then, the BLDCM and SRM drive system are introduced and their mathematical models are built. Based on the models, FPID and NNPID controller are designed in detail. Finally, the performances of the designed controllers are tested by simulation. The simulation results show that compared with C-PID controller, both FPID and NNPID controller can improve the performance of the system significantly.