Expert Systems with Applications 36 (2009) 3454–3458
Contents lists available at ScienceDirect
Expert Systems with Applications journal homepage: www.elsevier.com/locate/eswa
Adaptive fuzzy APSO based inverse tracking-controller with an application to DC motors Karim H. Youssef, Hasan A. Yousef *, Omar A. Sebakhy, Manal A. Wahba Department of Electrical Engineering, Alexandria University, Alexandria 21544, Egypt
a r t i c l e
i n f o
Keywords: Particle swarm optimization (PSO) Fuzzy neural networks (FNN) Least squares (LS) System identification Inverse control (IC)
a b s t r a c t This paper introduces the use of the adaptive particle swarm optimization (APSO) for adapting the weights of fuzzy neural networks (FNN) on line. The fuzzy neural network is used for identification of the dynamics of a DC motor with nonlinear load torque. Then the motor speed is controlled using an inverse controller to follow a required speed trajectory. The parameters of the DC motor are assumed unknown as well as the nonlinear load torque characteristics. In the first stage a nonlinear fuzzy neural network (FNN) is used to approximate the motor control voltage as a function of the motor speed samples. In the second stage, the above mentioned approximator is used to calculate the control signal (the motor voltage) as a function of the speed samples and the required reference trajectory. Unlike the conventional back-propagation technique, the adaptation of the weights of the FNN approximator is done on-line using adaptive particle swarm optimization (APSO). The APSO is based on the least squares error minimization with random initial condition and without any off-line pre-training. Simulation results are presented to prove the effectiveness of the proposed control technique in achieving the tracking performance. Ó 2008 Elsevier Ltd. All rights reserved.
1. Introduction Particle swarm optimization (PSO) is a population-based optimization technique first introduced by Kennedy and Eberhart (1995). The PSO is considered the competitor to the genetic algorithms (GA) and there is a lot of research comparing between them (Boeringer & Werner, 2004). The motivation for the development of the PSO was based on the simulation of animal social behaviors such as bird flocking fish, schooling, etc. The population in PSO is called a swarm and the individuals, referred to as particles, are candidate solutions to the optimization problem at hand in the multidimensional search space. Each dimension of this space represents a parameter of the problem to be optimized. The algorithm does not require the objective function to be differentiable and continuous and it can be applied to nonlinear and non-continuous optimization problems. PSO has been applied to some power system problems such as, state estimation, optimal power flow and reactive power compensation (Heo, Lee, & Garduno, 2006; Lu & Juang, 2005; Naka, Fukuyama, Genji, & Yura, 2001; Naka, Genji, Yura, & Fukuyama, 2003; Zhao, Guo, & Cao, 2005). It has been used also in the tuning of PID controllers (Han, Huang, Jia, Wang, & Li, 2005; Jun, Xin, Huayong, & d Z. Jianmin, 2006), adaptive control (Conradie, Miikkulainen, & Aldrich, 2002; Wang, Wang, Qu, & Yang,
2005) and nonlinear observers (Ke, Li, & Qian, 2004). During each iteration in the particle swarm optimization process, each particle accelerates in the direction of its own personal best solution found so far, as well as in the direction of the global best position discovered so far by any of the particles in the swarm. This means that if a particle discovers a promising new solution, all the other particles will move closer to it, exploring the region more thoroughly in the process. In this paper, the PSO is used for designing an adaptive inverse nonlinear controller for DC motors having nonlinear loads and unknown parameters. The controller objective is to let the motor track a desired reference trajectory. The nonlinear identification is achieved using a fuzzy neural network approximator with varying weights. These weights are updated every iteration using the PSO technique in conjunction with a fitness function. The paper is organized as follows. In Section 2, the dynamics of the DC motor with nonlinear load is presented. The inverse controller for speed tracking is illustrated in Section 3 and the construction of the FNN is discussed in Section 4. The detailed PSO algorithm is given in Section 5 and finally, simulation results are given in Section 6 to validate the effectiveness of the proposed controller. Conclusion is outlined in Section 7. 2. The DC motor dynamics
* Corresponding author. Tel.: +20 123338717; fax: +20 35921853. E-mail addresses:
[email protected],
[email protected] Yousef). 0957-4174/$ - see front matter Ó 2008 Elsevier Ltd. All rights reserved. doi:10.1016/j.eswa.2008.02.052
(H.A.
The DC motor dynamics are given by the following two equations (Weerasooriya & El-Sharkawi, 1991):
3455
K.H. Youssef et al. / Expert Systems with Applications 36 (2009) 3454–3458
KxðtÞ ¼ Ra ia ðtÞ La Kia ðtÞ ¼ J
dia ðtÞ þ eðtÞ dt
ð1Þ
dxðtÞ þ DxðtÞ þ T L ðtÞ dt
f ðxðk þ 1Þ; xðkÞ; xðk 1ÞÞ ¼
ð2Þ
1 ½xðk þ 1Þ axðkÞ bxðk 1Þ f cx2 ðkÞsignxðkÞ dx2 ðk 1ÞsignxðkÞ ð7Þ
where x(t) is the motor speed in rad/sec; e(t) is the motor terminal voltage in volt; ia is the armature current in A; TL(t) is the load torque in Nm; J is the rotor inertia in Nm s2; K is the motor torque constant and voltage constant in Nm A1; D is the damping constant in Nm s; Ra is the armature resistance in X; La is the armature inductance in H. The nonlinear load torque can be expressed as T L ðtÞ ¼ gðxðtÞÞ
ð3Þ
where g() is a nonlinear function. In this paper we assume that the nonlinear load torque is expressed as T L ðtÞ ¼ lx2 ðtÞsignðxðtÞÞ
ð4Þ
where l is constant. This load torque is a common characteristic of most propeller-driven and fan type loads. The discrete time model of the motor-load dynamics is derived by combining Eqs. (1), (2), and (4) and then replacing the speed differentials and the torque differentials with backward finite difference (Weerasooriya & ElSharkawi, 1991). The resulting discrete model can be written as xðk þ 1Þ ¼ axðkÞ þ bxðk 1Þ þ cx2 ðkÞsignxðkÞ þ dx2 ðk 1ÞsignxðkÞ þ neðkÞ
ð5Þ
where a, b and n are constants depending on the motor parameters J, K, D, Ra, La and the sampling period T, while c and d in addition to being functions of the above parameters are also functions of l. 3. The inverse controller Inverse controllers have been used in many control and electric drive applications (Wang et al., 2005). Fig. 1 shows the basic concept of identification and inverse control of the DC motor using a FNN. The nonlinear function representing the input control voltage in terms of the motor speed is first identified using a combination of motor input–output variables using a FNN. The weights from the trained FNN identifier are then used in the controller to calculate the terminal voltage e(k) which will asymptotically drive the motor speed x(k) towards the specified reference trajectory r(k). Eq. (5) can be inversed to the form: eðkÞ ¼ f ðxðk þ 1Þ; xðkÞ; xðk 1ÞÞ
and it is assumed unknown. For on-line training, e(k), the controller output, is not available in the identification stage and so one can use the previous sample for the identification process and Eq. (6) can be written as eðk 1Þ ¼ f ðxðkÞ; xðk 1Þ; xðk 2ÞÞ
ð8Þ
and in the control stage the control voltage is calculated using the desired reference trajectory r(k) as follows: eðkÞ ¼ f ðrðkÞ; xðkÞ; xðk 1ÞÞ
ð9Þ
An inverse controller for DC motors was proposed in (Weerasooriya & El-Sharkawi, 1991) using neural networks but the training was done off-line with the conventional back-propagation technique and the neural network was so complicated. 4. Fuzzy neural networks In general, using Takagi–Sugueno fuzzy model, and using center of average defuzzification method, any nonlinear function of states f(u1, ,un) can be approximated by a function ^f ðu1 ; . . . un Þ in the form: PM ^f ðu1 ; ; un Þ ¼
l¼1 hl ð
PM
l¼1 ð
n Q
lil ðui ÞÞ
i¼1 n Q
ð10Þ
lil ðui ÞÞ
i¼1
where n is the number of states, lil (ui) is the membership degree of the ith state ui to its corresponding membership function in the lth Q rule, M is the number of rules and M ¼ ni¼1 mi ; mi is the number of membership functions assigned to each state ui and hl is the singleton output of the lth rule. Eq (10) can be rewritten as ^f ðu1 ; . . . ; un Þ ¼
M X
hl fl ðuÞ
ð11Þ
l¼1
fˆ
ð6Þ
where
Identifier ε (k − 1)
ω (k − 2)
z −1
eˆ(k − 1)
ω (k − 1)
FNN
Controller
r (k )
z −1 e(k − 1)
z −1
ω (k )
FNN
e(k )
DC motor
Membership functions
ω (k )
ω ( k − 1)
z −1
u1 Fig. 1. The proposed inverse controller for a DC motor drive.
u2
Fig. 2. Basic structure of FNN.
3456
K.H. Youssef et al. / Expert Systems with Applications 36 (2009) 3454–3458
where Qn
lil ðui Þ fl ðuÞ ¼ PM i¼1 Qn l¼1 ð i¼1 lil ðui ÞÞ
ð12Þ
is the fuzzy basis function (FBF) and hl, l = 1,..,M are adjustable parameters. In a matrix form, (12) becomes ^f ðu1 ; ; un Þ ¼ hT fðuÞ T
ð13Þ T
where h = [h1,. . ., hM] and n (u) = [n1 (u),. . .,nM (u)]. The basic structure of the FNN for identification of a two-state function f(u1, u2) is shown in Fig. 2. The identification process is reduced to estimating the parameter vector h and then using the fuzzy basis function expansion of (13) to evaluate ^f ðu1 ; u2 Þ.
ð14Þ
where e(k 1) and ^eðk 1Þ are the actual and estimated motor voltage. The estimated voltage ^eðk 1Þ is calculated using the FBF expansion of (13) where the parameter vector h is replaced by the position vector Xi of each particle in the swarm. In our case the state vector is selected as u = [x(k) x(k 1) x(k2)]T in the identification stage while in the control stage it is selected as u = [r(k)x(k)x (k1)]T. The objective (fitness) function Ji(k) that has to be minimized at each iteration k is expressed as the square of the error function given in (14) among a moving window of N samples as follows: k X
ðX Ti ðkÞnðxðjÞ; xðj 1Þ; xðj 2ÞÞ eðj 1ÞÞ2
ð17Þ
where S ¼
j2/
p2 ffiffiffiffiffiffiffiffiffiffi ffi is the Clerc’s constriction factor 2 / 4/j
(Carlisle, 2002) and u = c1 + c2 > 4, c1 and c2 are acceleration constants and rand() is a uniformly distributed random number between 0 and 1. It has been shown that (Carlisle, 2002) the best performance is obtained by setting u = 4.1 and taking c1 = c2. Step 3. Evaluation of objective function and updating local best memory:The fitness function of each particle Ji(k) is calculated. The best fitness value of each particle is also updated as follows: k X
ðPTi ðkÞnðxðjÞ; xðj 1Þ; xðj 2ÞÞ eðj 1ÞÞ2
j¼kN
The PSO has been used for training neural networks (Natarajan, Periasamy, & Saravanan, 2007), fuzzy neural networks (FNN) (Feng, 2006; Kim & Cho, 2005) and parameter estimation (Huang & Wang, 2005; Ursem & Vadstrup, 2004; Yi-jian, Jian, & Shu, 2005). For FNN, the dimension of the problem (d) is the number of weights (i.e. the number of fuzzy rules) which can be calculated as d ¼ ðN m Þn , where Nm is the number of membership functions of each state ui and n is the number of states. Position of each particle in the population constitutes a possible solution of the parameter vector h. In order to apply the PSO algorithm, the objective function has to be formulated first. The error function e(k1) at (k1)th sample is defined as
J i ðkÞ ¼
ð16Þ
X i ðk þ 1Þ ¼ X i ðkÞ þ V i ðk þ 1Þ
pbesti ðkÞ ¼
5. The PSO algorithm
eðk 1Þ ¼ ^ eðk 1Þ eðk 1Þ
V i ðk þ 1Þ ¼ S½VðkÞi þ c1 randð Þ ðPi ðkÞ X i ðkÞÞ þ c2 randð Þ ðP g ðkÞ X i ðkÞÞ
ð15Þ
j¼kN
X Ti ðkÞ
where is the position vector of dimension d, n(x(j), x(j 1), x(j 2)) is a fuzzy basis function of the form (12) of dimension d. For a Z-particle population and d-dimensional optimization problem, the basic PSO algorithm is implemented in the following steps: Step 1. Generation of initial population:Initial positions X 0i ¼ and initial velocities V 0i ¼ ½vi1 vid T ; ½xi1 xid T i ¼ 1; :::; Z are generated randomly within the search space. The initial fitness value of each particle is evaluated as Ji(0) using the fitness function (15) and the local best of each particle pbesti is set to its current fitness value, i.e. pbesti(0) = Ji(0) and the initial local best position Pi of each particle is set to its initial position Pi(0) = Xi(0). The global best value of the position gbest is set to the best value of pbest and the corresponding particle position is taken as the position of the global best position Pg. Step 2. Modification of each particle velocity and position: The velocity and position of each particle are updated using the following equations:
ð18Þ If the value is better than the current pbesti of the particle, the pbesti value is replaced by the current value of the objective function and the local best position of the particle Pi is set to its current position Xi. Mathematically, 9 If J i ðkÞ < pbest i ðk 1Þ > > > > > pbesti ðkÞ ¼ J i ðkÞ > > > = P i ðkÞ ¼ X i ðkÞ ð19Þ > else > > > > pbesti ðkÞ ¼ pbest i ðk 1Þ > > > ; P i ðkÞ ¼ P i ðk 1Þ Step 4. Update global best memory:The global best value gbest is set to the best value of pbesti. The corresponding local best position Pi is taken as the position of the global best position Pg. Step 5. Calculate the control voltage:In each iteration, the control voltage ek is calculated using the global best minimum position (the solution with minimum least square error that has been obtained so far in the whole population) as follows: eðkÞ ¼ PTg ðkÞnðrðkÞ; xðkÞ; xðk 1ÞÞ
ð20Þ
Step 6. Start the next iteration by going to Step 2:
6. Simulation The proposed controller is applied to a 1 hp, 220 V, 550 rpm DC motor having the following parameters: J = 0.068 kg m2, K = 3.475 Nm A1, Ra = 7.56 X, La = 0.055 H, D = 0.03475 Nm s, l = 1.95 Nm s2 and T = 40 ms. The discrete model of the motor given in (5) is evaluated as xðk þ 1Þ ¼ 1:2354xðkÞ 0:4864xðk 1Þ þ 0:0707eðkÞ 0:369signðxðkÞÞx2 ðk 1Þ þ 0:0545signðxðk 1ÞÞx2 ðk 1Þ Three membership functions are assigned for each state as shown in Fig. 3 and are given by 9 1 l1 ðui Þ ¼ 1þe0:4ðu i þ5Þ > > = ui 2 ð21Þ l2 ðui Þ ¼ eð 5 Þ > > ; 1 l3 ðui Þ ¼ 1þe0:4ðu 5Þ i Therefore the dimension of the search space is d = 27. The parameters of the PSO are: population size = Z = 300, u = 4.1 and the acceleration constants are equal. The moving window of data testing is
K.H. Youssef et al. / Expert Systems with Applications 36 (2009) 3454–3458
Fig. 3. Membership functions used for each input speed.
3457
Fig. 5. Response of the motor during starting and application of nonlinear load in the second run.
chosen to be N = 50 samples. Since the motor loading conditions are assumed changing ad unknown, the PSO algorithm needs to be adaptive. A lot of work has been done in the field of adaptive particle swarm optimization techniques (APSO) (Cai, Pan, & Chen, 2004; Carlisle & Dozier, 2002; Iwasaki & Yasuda, 2005; Xie, Zhang, & Yang, 2002; Zhang, Liu, & Clerc, 2003). The adaptation technique adopted here is to re-randomize, in each iteration, the positions and velocities of 10 particles chosen randomly. The motor speed is required to follow a reference trajectory of the form: 2 rðkÞ ¼ sinð0:5pkTÞ þ 0:5 sin pkT ð22Þ 7 The nonlinear load torque of (4) is assumed to start at t = 9 s. Figs. 4 and 5 show the reference and actual speed at two different runs (with two different random initial populations). The figures show that the actual speed follows the reference trajectory which means that the identification and control stages are both successful and that the identifier and the controller adapted themselves after the introduction of the nonlinear load torque. The same motor is now required to follow the same reference trajectory under a constant load torque of 5.5 Nm suddenly applied at t = 9 s. Speed tracking performance is shown in Fig. 6. It is evident that the proposed adaptive fuzzy inverse speed controller of DC motor based on adap-
Fig. 6. Response of the motor during starting and application of constant load.
tive particle swarm optimization is capable to track a reference trajectory irrespective of the unknown motor parameter and unknown loading conditions. 7. Conclusion
Fig. 4. Motor speed and reference speed during starting and application of nonlinear load in the first run.
The particle swarm optimization technique has been used in this paper for the training of an adaptive inverse controller used in speed control of DC motors having a nonlinear load torque. The nonlinear identification and control is achieved using a fuzzy neural network approximator while the particle swarm optimization is used in updating the weights of the network. The fitness function associated with the PSO is formulated as squares of error between the approximated and actual control signals. The motor speed has effectively tracked the required reference trajectory even with the sudden change in motor dynamics and that was due to the use of the adaptive particle swarm algorithm. The proposed algorithm can also be used to achieve speed tracking even when the motor parameters vary. Simulation results prove the effectiveness of the proposed controller. Unlike the conventional back-propagation technique, the adaptation of the weights of the FNN approximator is done on-line using adaptive particle swarm optimization (APSO)
3458
K.H. Youssef et al. / Expert Systems with Applications 36 (2009) 3454–3458
based on the least squares error minimization with random initial condition and without any off-line pre-training. References Boeringer, D. W., & Werner, D. H. (2004). Particle swarm optimization versus genetic algorithms for phased array synthesis. IEEE Transactions on Antennas and Propagation(52), 771–779. Conradie, A., Miikkulainen, R., & Aldrich, C. (2002). Adaptive control utilizing neural swarming. In Proceedings of the genetic and evolutionary computation conference, New York, USA. Cai, T., Pan, P., & Chen, J. (2004). Adaptive particle swarm optimization algorithm. In Proceedings of the fifth world congress on intelligent control and automation (pp. 2245–2247). Hangzhou, PR China. Carlisle, A., & Dozier, G. (2002). Tracking changing extrema with adaptive particle swarm optimizer. In Proceedings of WAC 2002, Orlando, Florida. Carlisle, A. J. (2002). Applying the particle swarm optimizer to non-stationary environments. A PhD Dissertation, Auburn University. Feng, H. (2006). Hybrid stages particle swarm optimization learning fuzzy modeling systems design. Tamkang Journal of Science and Engineering, 2(9), 167–176. Heo, J. S., Lee, K. Y., & Garduno, R. (2006). Multiobjective control of power plants using particle swarm optimization techniques. IEEE Transactions on Energy Conversion, 2(21), 552–561. Han, P., Huang, Y., Jia, Z., Wang, D., & Li, Y. L. (2005). Mixed H2 and H1 optimal PID control for superheated steam temperature system based on PSO optimization. In Proceedings of the fourth international conference on machine learning and cybernetics (pp. 960–964). Guangzhou, China. Huang, C., & Wang, M. (2005). A particle swarm optimization to identifying the ARMAX model for short-term load forecasting. IEEE Transactions on Power Systems, 2(20), 1126–1133. Iwasaki, N., & Yasuda, K. (2005). Adaptive particle swarm optimization using velocity feedback. International Journal of Innovative Computing, Information and Control, 3(1), 369–380. Jun, Z., Xin, F., Huayong, Y., d Z. Jianmin, Z. (2006). A particle swarm optimization approach for pid parameters in hydraulic servo control system. In Proceedings of the sixth world congress on intelligent control and automation (pp. 7725– 7729). Dalian, China. Ke, J., Li, Q., & Qian, J. (2004). Particle swarm optimization based nonlinear observer. In Proceedings of the fifth world congress on intelligent control and automation (pp. 1580–1583). Hangzhou, China.
Kennedy, J., & Eberhart, R. C. (1995). Particle swarm optimization. Proceedings of IEEE International Conference on Neural Networks, 1942–1948. Kim, D.H., & Cho, J.H. (2005). Optimal learning of fuzzy neural network using particle swarm optimization algorithm. ICCAS2005 June 2–5, KINTEX, Gyeonggi-Do, Korea. Lu, C., & Juang, C. (2005). Evolutionary fuzzy control of flexible AC transmission system. IEE Proceedings Generation, Transmission and Distribution(152), 441–448. Naka, S., Genji, T., Yura, T., & Fukuyama, Y. A. (2003). Hybrid particle swarm optimization for distribution state estimation. IEEE Transactions on Power Systems, 1(18), 60–68. Naka, S., Fukuyama, Y., Genji, T., & Yura, T. (2001). Practical distribution state estimation using hybrid particle swarm optimization. In Proceedings of IEEE power engineering society winter meeting (pp. 1–6). Columbus, Ohio, USA. Natarajan, U., Periasamy, V. M., & Saravanan, R. (2007). Application of particle swarm optimization in artificial neural network for the prediction of tool life. International Journal of Advanced Manufacturing Technology, 871–876. Ursem, R. K., & Vadstrup, P. (2004). Parameter identification of induction motors using stochastic optimization algorithms. Applied Soft Computing, 4(1), 49–64. Wang, Y., Wang, K., Qu, J., & Yang, Y. (2005). Adaptive inverse control based on particle swarm optimization algorithm. In Proceedings of the IEEE international conference on mechatronics & automation (pp. 2169–2172). Niagara Falls, Canada. Weerasooriya, S., & El-Sharkawi, M. A. (1991). Identification and control of a DC motor using back-propagation neural networks. IEEE Transactions on Energy Conversion, 4(6), 663–669. Xie, X., Zhang, W., & Yang, Z. (2002). Adaptive particle swarm optimization on individual level. In Proceedings of the international conference on signal processing (ICCP) (pp. 1215–1218). Beijing, China. Yi-jian, L., Jian, Z., & Shu, W. (2005). Parameter estimation of cutting tool temperature nonlinear model using PSO algorithm. Journal of Zhejiang University Science, 1026–1029. Zhang, W., Liu, Y., & Clerc, M. (2003). An adaptive PSO algorithm for reactive power optimization. In Proceedings of the sixth international conference on advances in power system control, operation and management, APSCOM 2003, Hong Kong. Zhao, B., Guo, C. X., & Cao, Y. J. (2005). A multiagent-based particle swarm optimization approach for optimal reactive power dispatch. IEEE Transactions on Power Systems, 2(20), 1070–1078.