Acta Polytechnica doi:10.14311/AP.2018.58.0271 Acta Polytechnica 58(5):271–278, 2018 © Czech Technical University in Prague, 2018 available online at http://ojs.cvut.cz/ojs/index.php/ap INTELLIGENT CONTROLLER FOR TRACKING A 14-INCH CELESTRON TELESCOPE Abdel-Fattah Attiaa, b a Kafrelsheikh University, Faculty of Engineering, Department of Electrical Engineering, P.O. 33516 Kafrelsheikh, Egypt b Intelligent System Research Group (ISRG), Kafrelsheikh University, Kafrelsheikh, Egypt correspondence: aheliel@eng.kfs.edu.eg Abstract. The paper proposes a design of two fuzzy and Proportional-Integral-Derivative (PID) controllers for a position tracking of the 14′′ Celestron telescope. The position responses; right ascension and declination in such a way that it minimizes the integral absolute error (ITAE) using a modified particle swarm optimization (MPSO). Based on the structure of the MPSO, the accelerated coefficients of the particle swarm optimization are adapted dynamically by minimizing the system error with the iteration index. The adaptive control tool combines the Fuzzy controller and MPSO to produce a powerful controller in the system (FLC-PSO). The parameters of membership functions and the PID gains are tuned simultaneously based on the MPSO, which is an efficient and simple tool for the multidimensional problem. The simulation results for both controllers are analyzed and compared on a basis of the time response specifications. Keywords: static fuzzy controller; adaptive fuzzy controller; improved particle swarm algorithm. 1. Introduction At present, there are many evolutionary computation algorithms. Particle swarm optimization (PSO) is one of them. The PSO has many advantages, such as simplicity to implement and fast convergence as in Van Den Bergh, Frans [1]. Despite the above ad- vantages, the standard PSO algorithm provides local solutions easily when solving complex optimization issues. Recently, many articles are being presented to overcome this weakness and improve the PSO stan- dard performance. Adaptive PSO by Xie, Zhang, and Yang [2], fully informed PSO by Mendes, Kennedy, and Neves [3], PSO with disturbance term by Qingyuan, and Han [4]. Moreover, the performance of the Particle swarm optimization is slower, as search space dimensionality increases. Recently, many articles covered optimiza- tion approaches for tuning methods [5]. In the articles, the particle swarm optimization (PSO) and genetic al- gorithm (GA) are used to improve the input / output membership functions (MFs). The PSO is simple to implement and faster than the GA for tuning the MFs, which will enhance the performance of the fuzzy con- trollers [5]. Authors of [6–11] tried to improve different optimization methods for tuning the MFs of FLCs and coefficient of linear controllers to make it faster and more reliable for real applications. Nowadays, other methods are used to enhance the performance of the traditional controllers such as the fractional order systems [19, 20]. The pointing, tracking and imaging of a modern telescope are a very important processes. The driving system of the telescope depends on two DC motors working together to track a predefined position. The mechanisms to be controlled are, therefore, the Right Ascension (RA) and Declination (DEC) drives. There- fore, the precise control system is needed to solve such problem [1]. The purpose of this research is to describe and implement the algorithms used in the control system for the Celestron Telescope. These con- trol algorithms must be robust, accurate and easy to implement. This research study will introduce a new modification to the original PSO to improve the global performance of the basic PSO. In this research, two fuzzy controllers and a classical tuned PID controller were proposed to control the electric motor driving the Celestron telescope. The classical fuzzy controller has a fixed fuzzy rule. It is like the one proposed in a previ- ous work [12, 14]. The proposed fuzzy controller uses an improved PSO algorithm to dynamically change rules for a better stability, settling time, rise time, maximum overshoot and integral absolute error. In this paper, the performance of the PID tuning algorithms is analyzed and compared to both fixed and adaptive fuzzy logic controllers based on time response specifications. The remainder of the article is organized as follows. Section 2 provides the 14′′ Celestron telescope model. The PID controller is provided in Section 3. Static fuzzy controller components are introduced and dis- cussed in Section 4. Section 5 proposed an improved particle swarm optimization algorithm. The enhanced PSO algorithm was tested for adjusting fuzzy logic controllers described in Section 6. Section 7 illustrates the results and conclusions of the proposed control techniques. A conclusion and extensions are addressed in the last section. 271 http://dx.doi.org/10.14311/AP.2018.58.0271 http://ojs.cvut.cz/ojs/index.php/ap Abdel-Fattah Attia Acta Polytechnica Figure 1. The 14′′ Celestron Telescope [15]. 2. Mathematical description of the telescope model The 14′′ Celestron telescope is shown in Figure 1 [15]. The Right Ascension (RA) coordinates and the Decli- nation (DEC) have two motor drives of the telescope movements on both sides [15]. The nonlinear differ- ential equations of the Celestron telescope model are expressed mathematically as follows: M(θ)θ̈ + C(θ, θ̇) + G(θ) = τ, (1) M(θ)θ̈ + N(θ, θ̇) + τd = τ, (2) where: θ is the joint angular position, θ̇ is velocity and θ̈ is the acceleration term. Each one can be represented as follows: θ = [ θ1 θ2 ] , θ̇ = [ θ̇1 θ̇2 ] , and θ̈ = [ θ̈1 θ̈2 ] The unknown dynamics are represented by a constant disturbance; τd. The input torques τ1 and τ2 control the outputs θ1 and θ2 for a coupled telescope model. It is required to introduce a compensator to decouple this model. Thus, the decoupled system consists of independent variable systems. The telescope model compensator represents a linear system, which allows using the linear PID controller to control [13]. The nonlinear model consists of a compensator plus two parallel PID controllers. The controller is a PID- PSO hybrid controller for driving the DC motor. The controller consists of a state feedback compensator and a process with a state vector. 3. PID Controller The position errors of each arm are measured. The joint velocities measurements are then estimated. De- pending on the position errors and shared speeds, the PID controllers are defined by using an additional control signal u. The output of the PID controller is described as [13] u = −kpeθ −kdeθ −ki�. (3) The total input of the non-linear model is described as τ = M(θ)(kpeθ + kdėθ + ki�) + N(θ, θ̇), (4) ėθ1 eθ1 NL NS Z PS PL NL NL NL NL NS Z NS NL NL NS Z PS Z NL NS Z PS PL PS NS Z PS PL PL Table 1. Look-up table for Fuzzy Rules. where �(t) is the integral of the control error e(t). The controller parameters are proportional gain kp, integral gain ki, and derivative gain kd. The position error eθ is the difference between the required angle (θd) and the final position angle (θ) of the telescope in a given direction for the right ascension or declination positions. Enhanced gains from the PID controllers [kp1,kd1,ki1,kp2,kd2,ki2]T are then determined by us- ing the modified PSO algorithm. Figure 2 shows the PID controllers for the decoupled telescope model. The coefficients Kp1, Ki1, Kd1, Kp2, Ki2 and Kd2 are the core parameters in the PID controllers for both the RA and DEC axis. The MPSO algorithm will be used to select the optimal efficiency factor to make the output values meet the required control specification. 4. Fuzzy Logic Controller (FLC) The main components of the static fuzzy controller with a fixed membership functions (SFLC) consists of four components: [6, 14]. Figure 3 shows the FLC controllers for the telescope model. (1.) Fuzzification interface. The global input vari- ables of the SFLC controllers are the position devi- ation error eθ and its rate of change ėθ. τ1 is the output variable. Five fixed fuzzy sets (FFS) are designed for each input and output variables of the SFLC. The fuzzy input vector of each FLC-PSO for input/output variables consists of the previous vari- ables used in the SFLC with five linguistic variables using adaptive fuzzy sets (AFS). In Figure 4, the solid lines represent the fixed fuzzy sets of the SFLC. While the dashed lines represent the adaptive fuzzy sets of the FLC-PSO. (2.) Data base. The database has the definitions of the MFs defined for every fuzzy control variable. The linguistic variables such as the PL (Positive Large), PS (Positive Small), Z (Zero), NS (Nega- tive Small) and NL (Negative Large) are shown in Figure 4 and indicated in Table 1. (3.) The inference system. There are 25 rules con- structed based on five Gaussian MFs groups selected for I / O variables in the fuzzy control unit. These fuzzy rules define control objectives using fuzzy terms as shown in Table 1. (4.) Defuzzification stage. The center average de- fuzzifier is used to compute the fuzzy output, which represents the defuzzification stage [6–8]. 272 vol. 58 no. 5/2018 Intelligent Controller for Tracking a 14-Inch Celestron Telescope Figure 2. PID controllers for the decoupled telescope model. Figure 3. FLC controllers for the nonlinear telescope model. 5. Proposed improved Particle Swarm Optimization Algorithm (MPSO) In particle swarm optimization (PSO), at the begin- ning of the iterations, the particles are randomly dis- tributed. The best solutions are scattered in the search space. The variety of acceleration parameters in the PSO provides faster convergence than fixed coefficients. Starting the acceleration parameter C1 at a high value will create the best solutions through the iterations. This means that the population converges to a smaller subset of the search area, and the value of C1 will greatly decrease with the iteration index: C1 = C1ie−t/tmax −C1f, (5) where t is the current iteration index, and tmax is the maximum number of iterations. In the early iterations, particle members are very random. The acceleration parameter C2 increases significantly with the iteration index to exploit the enhanced PSO in the zone created by the best current solutions: C2 = C2iet/tmax. (6) The dynamic operator’s idea was discussed and ex- plained previously in [17, 18]. 273 Abdel-Fattah Attia Acta Polytechnica Figure 4. (a) Membership Functions (MFs) of position error for SFLC and FLC-PSO Controllers. (b) MFs of rate of error for SFLC and FLC-PSO Controllers. (c) MFs of control action for SFLC and FLC-PSO Controllers. (d) The output surfaces Viewer of RA & DEC SFLC Controller. Figure 5. Flowchart for improved parameters for membership functions for FLC-PSO controllers. 274 vol. 58 no. 5/2018 Intelligent Controller for Tracking a 14-Inch Celestron Telescope eθ1 ėθ1 Torque 1; τ1 Parameters c1,σ1, . . . ,c5,σ5 c1,σ1, . . . ,c5,σ5 c1,σ1, . . . ,c5,σ5 30 2 × 5 2 × 5 2 × 5 Table 2. Optimized parameters of FLC-PSO for RA axis. eθ2 ėθ2 Torque 2; τ2 Parameters c1,σ1, . . . ,c5,σ5 c1,σ1, . . . ,c5,σ5 c1,σ1, . . . ,c5,σ5 30 2 × 5 2 × 5 2 × 5 Table 3. Optimized parameters of FLC-PSO for DEC axis. 6. Adaptive Fuzzy Controllers using modified PSO This section provides a brief overview of the modified PSO control design and fuzzy logic controllers. The FLC-PSO, using an adaptive AFS based on the PSO, has the same inputs and outputs as the SFLC. There are 25 rules for FLC-PSO and SFLC controllers. The rules can be expressed as follows: If eθ is NS and ėθ is Z then τ is NS. There are 30 parameters to be optimized for each FLC-PSO controller based on their limitations, to form a set of n-particles. The membership functions (MFs) of the FLC-PSO controller are represented by the dotted lines shown in Figure 3. Tables 2 and 3 show the MFs of the FLC-PSO controller for the RA and DEC axis, respectively. These 60 parameters will be optimized using the MPSO. The flow chart explains the sequence of steps to be carried out in the PSO algorithm. Figure 5 illustrates the flowchart of the improved parameters for mem- bership functions of FLC-PSO controllers for RA and DEC axis drives. The following steps explained details of optimizing MFs parameters of the fuzzy controllers: (1.) Initialization. Initially, the controllers work with the parameters of static fuzzy controllers. The acceptable constraints for each Gaussian MF pa- rameters center parameter (∆c = [cmin,cmax], and width parameter ∆σ = [σmin,σmax]). Acceptable re- strictions are determined using the 2nd order fuzzy sets method explained in [17]. The whole system operation is defined based on traditional fuzzy con- trollers (SFLCs) and PSO parameters in Table 4. (2.) Generation. Generate n particles randomly within the acceptable limits stating at time counter t = 0, {Xj(0), j = 1, . . . ,n}, and velocity {Vj(0), j = 1, . . . ,n}. (3.) Objective function evaluation Determine the fitness function f for each particle in the initial population. The parameters of fuzzy sets (vector x) are used to create FLC-PSO controllers for the RA axis and the DEC axis. The best initial individuals are achieved among the population. In this article, particles number (swarm size) n 50 inertia weight (initial value) wmax 0.9 inertia weight (final value) wmin 0.25 maximum number of iterations tmax 40 acceleration param. 1 (initial value) C1i 2 acceleration param. 2 (initial value) C2i 0.5 acceleration param. 1 (final value) C1f 0.5 acceleration param. 2 (final value) C2f 2 maximum velocity v1max 2.0 minimum velocity v1min −1.5 Table 4. PSO Parameters. Integrated Time and Absolute Error (ITAE) is used as an objective function f = ∫ ∞ 0 t|e(t)|dt, (7) Where e(t) is the position error in the RA and DEC positions for each FLC-PSO controller such as shown in Figure 3. (4.) Set t = t + 1. (5.) Wight updating. The new inertia weight w(t) will be w(t) = wmax + tmax − t tmax (wmax −wmin). (8) (6.) Velocity updating. Based on the global best and individual best of each particle, the jth particle velocity is updated: vj(t) = w(t)vj(t−1) +C1r1 ( x∗j (t−1)−xj(t−1) ) + C2r2 ( x∗∗j (t− 1) −xj(t− 1) ) , (9) where r1 and r2 are random numbers in [0, 1], C1 and C2 are the acceleration parameters varying with the iteration index based on the PSO improvements described in (5) and (6). (7.) Position updating. Updated velocities will change each particle to its position: xj(t) = xj(t− 1) + vj(t). (10) 275 Abdel-Fattah Attia Acta Polytechnica Figure 6. Convergence properties of the proposed MPSO algorithm: ITAE criterion case. Transient response FLC-PSO SFLC PID-PSO Classical PID characteristics RA DEC RA DEC RA DEC RA DEC Rise time (sec) 0.3355 0.33 0.439 0.395 0.0625 0.061 0.9755 0.98 Settling time (sec) 0.75 0.6 0.9 0.65 0.4 0.35 2.6 2.25 Peak time (sec) – – – – 0.11 0.103 – – Maximum overshoot 0 0 0 0 22.2 % 20.0 % 0 0 Table 5. Transient response characteristics for RA & DEC axis controllers’ schemes. (8.) Best individual update. Evaluate each object according to the updated location using the ob- jective function in (7). If fj < f∗j , j = 1, . . . ,n, then update individual best as X∗j (t) = Xj(t) and f∗j = fj and go to step 9; else go to step 9. (9.) Global best updating. Looks for the minimum value of fmin around f∗, where min is the index of the particle with minimum objective function, i.e., min ∈ {1, . . . ,n} If fmin < f∗∗, then update the globally best as X∗∗(t) = Xmin(t) and f∗∗(t) = fmin(t) and go to step 10; else go to step 10. (10.) Stopping criteria. The particle swarm is re- peated until it reaches the stop criterion or reaches the maximum iterations. 7. Results and discussions The efficiency of the proposed control schemes are validated with different simulation computations performed. Figure 6 illustrates the fitness curve for the PID-PSO and FLC-PSO controllers. The PID-PSO fitness curve is faster than the fitness curve of the FLC-PSO Controllers. The opti- mized Gaussian fuzzy sets for the FLC-PSO con- trollers are shown in Figure 3 as dashed lines. The optimized PID coefficients are shown in Ta- ble 5. The results of position responses and velocity re- sponses for RA & DEC coordinates are shown in Figures 7 and 8. After defining the control parame- ters, such as stability, settling time, overshoot, fitness value, convergence iteration, running time and the PID parameters for MPSO optimization method, they were illustrated in Figure 7. The proposed FLC-PSO controllers provide a bet- ter dynamic response compared to the PID-PSO con- trollers. Table 5 shows the comparisons of the control specification for the FLC-PSO, SFLC, PID-PSO and Classical Controllers. The results shown in Table 5 and Figure 7 show that the system with the static fuzzy controller (SFLC) in- creased by 0.439 seconds and 0.395 seconds in response to changes in the RA and DEC positions, respectively. When using the FLC-PSO controllers for the telescope movements, the rise and settling time are 0.3355 sec and 0.33 sec respectively, which is much better than using the SFLC, as shown in Figure 7 and Table 5. The rise times for the system using classical PID and PID-PSO controllers are 0.9755 sec, 0.98 sec for the RA responses and 0.0625 sec, 0.0.061 sec for the DEC responses. Both the SFLC and FLC-PSO controllers suppress and eliminate the overshoot response with an acceptable rise time as shown in Figure 7 and Ta- ble 5. Because of using a fixed CCD camera on the telescope during the tracking of a sky object, it is an impermissible response overshoot. Based on the MPSO algorithm, different sets of gains have been experienced in the case of the PID controllers to control specifications. We have seen that if PID gains are increased to improve the rise time, there will be an inherent tendency for the overshoot response. This is impermissible in the case of tele- scopes with a fixed CCD camera. These requirements are achieved for the telescope movements based on the FLC-PSO and SFLC controllers for the RA and DEC positions. Figure 7 shows the improved rise, settling times and stability periods and increased overshoot responses to the PID-PSO controllers. Therefore, the 276 vol. 58 no. 5/2018 Intelligent Controller for Tracking a 14-Inch Celestron Telescope Figure 7. Position responses: (a) RA axis and (b) DEC axis. Figure 8. Velocity responses: (a) RA axis and (b) DEC axis. application of the FLC-PSO controller improves the dynamic response of the overall system of the astro- nomical telescope. Although the PID-PSO controller shows the fastest rising and settling times compared to the FLC-PSO controller, the FLC-PSO controller suppresses excess responses with the best coefficient of the damping factor. The error values for speed and position become zero when the system reaches the required references for the RA and DEC respectively, as shown in Figure 8. The results confirmed that the MPSO algorithm performed effectively to improve the FLC-PSO, PID-PSO performance compared with the SFLC and Classical PID Controllers for the RA and DEC axis of the Celestron telescope. 277 Abdel-Fattah Attia Acta Polytechnica 8. Conclusions In this paper, dynamic acceleration parameters were introduced for the PSO algorithm. This optimiza- tion of the PSO routing is optimized for a global search. Acceleration parameters speed up the PSO approach and prevent the PSO from stumbling at a locally optimized level. The FLC-PSO membership function parameters are automatically updated based on the MPSO. The proposed adaptive FLC-PSO con- troller, tuned by the MPSO, improves the stability and settling time and reduces the damping factor of the Celestron telescope model. Results include the superior FLC-PSO compared with SFLC and classi- cal PID controllers even when the PID is optimized for the performance of the RA and DEC axis of the Celestron telescope. References [1] Van Den Bergh, Frans. “An Analysis of Particle Swarm Optimizers (PSO).” Pretoria, University of Pretoria (2001): 78-85. [2] Xie, X.-F., Zhang, W.-J. and Yang, Z.-L., (2002), “Adaptive Particle Swarm Optimization on Individual Level”, Int. Conf. On Signal Processing (ICSP), pp: 1215-1218 [3] Mendes, R., Kennedy, J., and Neves, J., (2004) “The fully informed particle swarm: simpler, maybe better, ” IEEE Trans. on Evolutionary Comput., Vol. 8 (3), pp. 204–210. [4] He, Q. and C. Han, 2006. An improved particle swarm optimization algorithm with disturbance term. Comput. Intell. Bioinfo., 4115: 100-108. [5] Fereidouni, Alireza, Mohammad AS Masoum, and Moayed Moghbel. “A new adaptive configuration of PID type fuzzy logic controller.” ISA transactions 56 (2015): 222-240. [6] Gharghory, Sawsan, and Hanan Kamal. “Modified PSO for optimal tuning of fuzzy PID controller.” IJCSI International Journal of Computer Science Issues 10.2 (2013): 462-471. [7] Abdo MM, Vali AR, Toloei AR, Arvan MR. Stabilization loop of a two axes gimbal system using self-tuning PID type fuzzy controller. ISA Trans 2014; 53:591–602. [8] Cheng, P. C., Peng, B. R., Liu, Y. H., Cheng, Y. S., Huang, J. W. (2015). Optimization of a fuzzy-logic- control-based MPPT algorithm using the particle swarm optimization technique. Energies, 8(6), 5338-5360. [9] Vlachogiannis JG, Lee KY. Contribution of generation to transmission system using parallel vector evaluated particle swarm optimization. IEEE Trans Power Syst 1765–1774;205(4):20. [10] Ghosh, S.; Kundu, D.; Suresh, K.; Das, S.; Abraham, A.; Panigrahi, B.K.; Snasel, V.;On Some Properties of the lbest Topology in Particle Swarm Optimization . Proceedings of Ninth International Conference on Hybrid Intelligent Systems, IEEE Computer Society Press. 2009 Page(s):370 – 375 [11] Chopra S, Mitra R, Kumar V. Auto tuning of fuzzy PI type controller using fuzzy logic. Int J Comput Cogn 2008; 6:12–8. [12] Hussein F. Soliman, Abdel-Fattah A. Attia, Mohammed A. L. Badr, Anas M. Osman and Abdul A. I. Gamaleldin, “Fuzzy logic controller for the electric motor driving the astronomical telescope”, Proc. SPIE 3351, 415 (1998); doi:10.1117/12.308827 [13] Attia A.-F. Hierarchical fuzzy controllers for an astronomical telescope tracking (2009) Applied Soft Computing Journal, 9 (1), pp. 135-141. [14] Attia, Abdel-Fattah, Jan J., P. Horáček, and F. Soliman, “Fuzzy Control for Astronomical Telescope Tracking”, 16th International Conference on Production Research, Prague, Czech Republic, 2001. [15] Celestron 11/14 Operating Manual. Celestron International Co. pp. 1-26, 1992. [16] Tang, K.S, Man, K.F., Chen, G. and Kwong, S., “An Optimal Fuzzy PID Controller”, IEEE Transactions on Industrial Electronics, 48, No. 4, pp. 757-765, 2001. [17] Attia, Abdel-Fattah, and P. Horáček. “Modeling Nonlinear Systems by a Fuzzy Logic Neural Network Using Genetic Algorithms.” Acta Polytechnica 41, no. 6 (2001). [18] Attia, Abdel-Fattah, Genetic Algorithms for Optimizing Fuzzy and Neuro-Fuzzy Systems. p. 107, CVUT Praha, (Czech Republic), 2002. [19] Padula, F., Visioli, A. (2011). Tuning rules for optimal PID and fractional-order PID controllers. Journal of process control, 21(1), 69-81. [20] Luo, Y., Chen, Y. Q., Wang, C. Y., Pi, Y. G. (2010). Tuning fractional order proportional integral controllers for fractional order systems. Journal of Process Control, 20(7), 823-831. 278 http://dx.doi.org/10.1117/12.308827 Acta Polytechnica 58(5):271–278, 2018 1 Introduction 2 Mathematical description of the telescope model 3 PID Controller 4 Fuzzy Logic Controller (FLC) 5 Proposed improved Particle Swarm Optimization Algorithm (MPSO) 6 Adaptive Fuzzy Controllers using modified PSO 7 Results and discussions 8 Conclusions References