"2017 Nineteenth International Middle East Power Systems Conference (MEPCON), Menoufia University, Egypt, 19-21 December 2017 A Novel Technique for Online Self-tuning of Fractional Order PID, Based on Takaji-Sugeno fuzzy Mahmoud S Gaballa Abdel-Ghany M Abdel-Ghany Department of Electric Power & Machines Helwan University, Faculty of Engineering Cairo, Egypt mahmoudsalahgaballa@gmail.com msg_salah@yahoo.com Department of Electric Power & Machines Helwan University, Faculty of Engineering Cairo, Egypt ghanymohamed@ieee.org ghanyghany@hotmail.com Mohiy Bahgat Department of Electric Power & Machines Helwan University, Faculty of Engineering Cairo, Egypt dr_mohiy_bahgat@yahoo.com drmohiybahgat@yahoo.com Abstract— Many techniques of online self-tuning for controller parameters have been presented in several studies [12-15]. This paper presents a new technique for online self-tuning of a Fractional Order PID (FOPID) controller based on both a type1Fuzzy and a Takaji-Sugeno Fuzzy and deployed to control the horizontal motion of a dual-axis photo voltaic sun-tracker. A modification based on Takaji-Sureno Fuzzy (TS-Fuzzy) has been applied on the Simulink Fractional Order PID block "nipid" from the toolbox of "ninteger" to become suitable for the purpose of the online self-tuning. Several experiments have been carried out on a system model under the control of the modified FOPID block and the results came very satisfactory. I. INTRODUCTION In previous works [1, 2], a design of a dual axis photovoltaic sun tracker system was presented, see Fig. 1. This study work presents an implementation of a Fractional Order PID as the position controller of the horizontal carriage of the sun tracker which is driven by a Brushless D.C (BLDC) motor. One contribution in this study is to present a new technique for FOPID online self-tuning for the five controller parameters (kp, ki, kd, λ and μ) during simulation time. Another contribution in this study is to demonstrate a modification on the nipid FOPID block to be suitable for the online self-tuning. Index Terms— Sun Tracking System, Takaji-Sugeno, TSFuzzy, Fractional Order PID, Online self-tuning. NUMENCLATURE θ Photovoltaic Panel Angular Position Photovoltaic Panel Angular Velocity b Motor viscous friction constant Kp Proportional gain of a PID controller Ki Integral gain of a PID controller. Kd Derivative gain of a PID controller. λ Integral fractional order μ Derivative fractional order J Moment of inertia L Electric induction Kt Torque constant Kb Electromotive force T Torque FOPID Fractional order PID V Input voltage signal R Motor resistance BLDC Brushless DC motor Wx Fuzzy weight of membership x Fig. 1. Dual-Axis PV Sun Tracker System The D.C motor control model [3], is shown in Figure 2: Fig. 2. The equivalent circuit of a D.C motor 978-1-5386-0990-3/17/$31.00 ©2017 IEEE where: b is the friction coefficient (N.m.s), J : is the moment of inertia (Kg.m2), R is the electric resistance (Ω), L is the electric inductance (H), Kt is the torque constant (N.m/A), and Kb is the electromotive force constant (V.sec/rad). The torque generated by a D.C motor is proportional to the magnetic-field strength and the armature current. The D.C motor used in this study is a permanent magnet D.C motor (constant magnetic field), therefore, the generated torque T is only proportional to the armature current (i) as T = K i. The induced back e.m.f (e) is proportional to the rotor angular velocity θ as e = K θ , Kb and Kt are equal, therefore K is used to represent both of them, The current can be derived as : Jθ+bθ=Ki (1) L +Ri =V Kθ (2) Applying Laplace transform to (1) and (2): s Js+b θ s =KI s Ls+R I s =V s Ksθ s From (3) and (4) we get : / = (3) (4) (5) An integration has to be applied to the speed to obtain the transfer function with the position as an output, by simply multiplying equation (5) by (1/s) as follows : = (6) The state-space representation can be deduced by choosing θ, θ and i as the state variables, while, V is the input and θ is the output as follows : θ θ 0 1 0 0 θ = 0 i θ + 0 V (11) u s = k + + k .s e s The fractional-order PID controller is represented as PIλ Dμ, and is described by the equation shown by Equation 12. u s = k + + k .s e s (12) where, λ: a real number represents the integration fractional order, µ: a real number represents the derivative fractional order, kp: the proportional gain of the PID, ki: the integral gain of the PID and kd: the derivative gain of the PID. Setting λ = 1 and µ = 1, tends to obtain a classical integer PID controller. The FO-PID controller provides more flexibility and better adjustment for the dynamics of control systems [4]. III. FRACTIONAL ORDER PID CONTROLLER ONLINE SELFTUNING Before going into the deep details of the tuning process, A real need arouse to have a Simulink block for the Fractional Order PID controller that enables the designer of changing the values of all of the five parameters (kp, ki, kd, λ and μ) during the simulation process. A. Modified FO-PID nipid block and detailed design steps The nipid is a visual Simulink block that enables the utilization of the Fractional Order PID in control. The block provides a form to set the values of the fractional order parameters μ and λ as well as the PID coefficients kp, ki and kd as shown in Fig 3. (7) 0 i θ y= 1 0 0 θ (8) i The output of the motor in (rad) is then passed to a gearbox with a static gain Kg, and therefore, the output equation can be accordingly changed to: θ (9) y= K 0 0 θ i II. INTEGER AND FRACTIONAL ORDER PID CONTROLLERS The PID refers to the first letters of the words of Proportional, Integral and Derivative Controller. PID controllers are actually the most widely used controllers in industry. It is considered the basic building block even in control network that are deployed in sophisticated control systems. The PID controller equation is shown by Equation 10. u t = k .e t + k e t dt + k (10) where, u(t):the output signal of the controller, e(t): the error signal, kp: the proportional gain of the PID, ki: the integral gain of the PID and kd: the derivative gain of the PID. The S-Domain PID equation is shown by Equation 11. Fig. 3. "nipid" Fractional-Order PID block parameters form The technique, mentioned in this section is aiming to performing an online self-tuning for the fractional order parameters μ and λ as well as the PID coefficients kp, ki and kd during the simulation. A satisfactory solution for this situation is to use the work space values for the above mentioned five variables instead of entering them as constant values, but unfortunately, it's found that the Simulink loads the values of the variables from the work space into the block once on running starting and doesn't update them during the simulation. The above mentioned restriction nessitates the need of having another fractional-order-PID block that provides external input channels for the five mentioned parameters. The ideas on which the design for a modified nipid block that provides external input channels for the five mentioned parameters are as follows: 1- Separate the action of the FOPID into three main actions which are P, I λ and Dμ , with each separate action has a unity gain and is provided with a subsequent multiplication block to enable applying external gains for each action (kp, ki and kd), and finally the outputs of the three separate actions are summed, see Figure 4. The 6 triangular memberships are represented by membership blocks each one gets the λ or μ value as an input and generates the weight of the membership, see Fig 6. Fig. 6. TS-Fuzzy weight calculation process of inputs 3- The realization of the TS-Fuzzy formula Equation 13 is obtained by implementing the model shown in Fig 8 with nipid blocks are configured as shown in Fig 7. Fig. 4. Modified nipid block abstract layout by separating the three control actions 2- Passing the values of μ and λ to the D and I blocks by means of utilizing TS-Fuzzy technique [6-11] to deploy 6 nipid sub-blocks for each of the new D and I mentioned block, and each one of the six nipid blocks has a predefined value for μ or λ. The input membership functions of both λ and μ value are chosen to be six triangular functions that are equally distributed over the range [0.0,1.0], and have their middle vertices placed at the points {0, 0.2, 0.4, 0.6, 0.8, 1},see Fig 5. Fig. 7. "nipid" Fractional-Order PID as an integrator with unity gain and order = 0.4 out = ∑ . ∑ ; out = ∑ . ∑ ; where:λ , μ ∈ 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 ; W is the weight of λ ; W is the weight of μ ; Fig. 5. Input Membership of the variables λ and μ F is the output of nipid whose λ value is λ (13) F is the output of nipid whose μ value is μ To validate the matching between the responses of both modified and normal nipid as integrators, another experiment has been carried out using the two blocks as fractional integrators and the two responses were then compared, see Fig 10. Fig. 10. Block diagram and responses of the modified nipid and normal nipid as integrators with lamda = 0.45 Utilizing the modified nipid as a fractional-order derivative The modified nipid block will be used as a derivative with a unit ramp input signal and μ=0.45, see Fig 11. Generation of the output signal goes through the following steps: 1- Calculate the weights of the memberships. From Fig 6, WSM = 0.75 and WLM = 0.25, the rest of the weights all equal to zero. Fig. 8. Modified-nipid integrator part basing on old nipid and TS-Fuzzy Utilizing the modified nipid as fractional-order integrator: The modified nipid will be used as an integrator with input signal equals to 1 and λ = 0.45, see Fig 9. The generation of the output signal goes through the following steps: 1- Calculate the weights of the memberships. From Fig 6, WSM = 0.75 and WLM = 0.25, the rest of the weights all equal to zero. 2- Consider the outputs of the two nipid blocks that have λ's corresponding to non-zero weights i.e. μ ϵ {SM , LM} ≡ μ ϵ {0.4, 0.6}, see Fig 6. 3- The output signal F, see Fig 11, is then calculated as : F= . . = 0.75 F + 0.25 F ; where FSM is the output signal of the nipid with μ = 0.4 and FLM is the output signal of the nipid with μ = 0.6 2- Consider the outputs of the two nipid blocks that have λ's corresponding to non-zero weights i.e. λ ϵ {SM , LM} ≡ λ ϵ {0.4, 0.6}, see Fig 6. 3- The output signal F, see Fig 9, is then calculated as : F= . . = 0.75 F + 0.25 F ; where FSM is the output signal of the nipid with λ = 0.4 and FLM is the output signal of the nipid with λ = 0.6 Fig. 11. Block diagram and response of the modified-nipid as a fractionalorder integrator at λϵ{0.4, 0.6} and the response of modified-nipid as a fractional integrator with λ = 0.45 To validate the matching of the responses of the modified and the normal nipid, another experiment was done using the two blocks as fractional derivatives having the same parameters, the two responses were compared, see Fig 12. Fig. 9. Output signals of normal nipid as a fractional integrator at λϵ{0.4 , 0.6}and that of modified-nipid with λ = 0.45 tuning and the modified nipid fractional order PID was used as the loop controller, see Fig 15. Fig. 12. The modified and normal nipid as derivatives with Mu=0.45 In the two above examples, comparing the responses of the normal and modified nipid showed a small difference between the two curves. Actually, this is very acceptable for two reasons, the first reason is that the difference is very small (about 1.2%), and the second reason is that fuzzy blending is, by nature, an approximate solution. However, a solution that actually minimized the mentioned difference is also tried here just by increasing the number of membership functions to be 11 instead of 6. The responses of the two above experiments with the new memberships is shown in Fig 13. Fig. 15. Deploying FLC and modified-nipid for FOPID parameter tuning The values of the parameters after tuning will be Kp2, Ki2, Kd2, μ2 and λ2, such that : Kp2 = Kp * Kp1 ; Ki2 = Ki * Ki1 ; Kd2 = Kd * Kd1 ; μ2 = μ * μ1 and λ2 = λ * λ1; where Kp1, Ki1, Kd1, μ1 and λ1 are the outputs of the Fuzzy Logic controller and Kp, Ki, Kd, μ and λ are the initial values of the parameter before tuning. The structure of fuzzy logic control goes through three main stages (fuzzification, rule base and defuzzification). 1- Fuzzification: In this stage the input values are converted into linguistic form. As demonstrated in Figure 16-A the controller has two inputs: error and error change signals. Fig. 13. Normal and modified nipid with 11 rules as integrators and derivatives B. Results of online self-tuning of Fractional Order PID controller The controlled model considered in this study is given in Fig 14. Fig. 14. The model considered for the implementation of PID and FOPID controllers The initial values for kp, ki and kd were deduced from the tuning technique of Zeigler-Nichols, and the two fractional order coefficients were firstly set to 1.0, the value of the friction coefficient b was then manually increased to simulate a real increase in rotor friction, and accordingly the response got slower. The goal now is to perform a parameter tuning process so that the new response is improved. A 25-rule base Fuzzy-logic controller was deployed to perform the online Fig. 16. A-Input memberships of e and Δe, B-Output memberships of FLC outputs The universe of discourse for both the two inputs is chosen to be in the range of [-1,1], and the linguistic labels are NB, NM, NS, Z, PS, PM and PB. The linguistic labels of the outputs are Z, MS, S, M, B, MB and VB. Figure 16-B shows the memberships of outputs of fuzzy logic control. TABLE V. RULE BASE MATRIX FOR Μ1 2- Rule Base A human decision process is simulated via a decision logic which is described by the rule base technique. Both error and change of error were assigned 7 linguistic labels, resulting in having 7 × 7 = 49 rule base. A rule simplification to 25 rule base was presented in [5] shown in Table 1, 2, 3, 4 and 5. TABLE I. RULE BASE MATRIX FOR KP1 ∆e/e NB NS ZE PS PB NB VB B ZE B VB NS VB B ZE B VB ZE VB B MS B VB PS VB MB S MB VB PB VB VB S VB VB TABLE II. RULE BASE MATRIX FOR KI1 ∆e/e NB NS ZE PS PB NB M S MS S M NS M S MS S M ZE M S ZE S M PS M S MS S M PB M S MS S M ∆e/e NB NB ZE NS MS ZE M PS MB PB VB NS MS S M B MB ZE M M M M M PS MB B M B MB PB VB MB M MB VB 3- Defuzzification In this stage, the fuzzy outputs are converted to crisp output. The parameter tuning was carried out via three combinations:(1)Tuning μ and λ only while keeping kp, ki and kd unchanged, (2)Tuning kp, ki and kd while keeping μ and λ unchanged and (3) Tuning all of the five parameters kp, ki, kd, μ and λ. A comparison between the time responses of the above three techniques in addition to the response of the system without tuning was made. The used model and the output responses were shown in Fig 17. TABLE III. RULE BASE MATRIX FOR KD1 ∆e/e NB NB ZE NS S ZE M PS MB PB VB NS S B MB VB VB ZE M MB MB VB VB PS B VB VB VB VB PB VB VB VB VB VB TABLE IV. RULE BASE MATRIX FOR Λ1 ∆e/e NB NB ZE NS MS ZE M PS MB PB VB NS MS S M B MB ZE M M M M M PS MB B M S MS PB VB MB M MS ZE Fig. 17. Several parameter combinations for tuning FOPID From Fig. 17, it was found that the best performance is achieved when all of the five parameters of the controller are tuneable during the simulation. IV. CONCLUSION This study presented an application of Fractional Order PID as the controller of a PV sun tracker horizontal dc motor. A technique for online self-tuning for all of the five parameters of the FOPID using a Fuzzy Logic Controller was introduced. A technical constraint aroused during the work, that is the used FOPID Simulink bock of "nipid" doesn't enable changing the controller parameters during the simulation time, therefore, a new tuneable FOPID block was designed basing of the old nipid and the TS-Fuzzy technique, the new FOPID block enables the parameters changing during the simulation. The tuning process was carried out via making several experiments changing the combinations of the tuned parameters in each experiments and the responses of the experiments were compared. Finally it was found that the best performance is achieved when all of the five parameters of the controller are tuneable.. REFERENCES [1] M. S. Gaballa, M. Bahgat and A. G. M. Abdel-Ghany, Modeling & TS Fuzzy control of a dual-axis sun tracker photo-voltaic panel fixed on a moving vehicle, 2016 Eighteenth International Middle East Power Systems Conference (MEPCON), Cairo, 2016, pp. 968-974. [2] Mahmoud S Gaballa, Mohiy Bahgat, Abdel Ghany M Abdel Ghany, Practical Design of the Feedback Element of the Horizontal Part of a Dual-axis Sun Tracker, Al-Azhar journal, 2016. [3] E. J. Hepzibah and R. Korah, FPGA implementation for speed monitoring and speed control of a DC motor using fuzzy logic, 2012 International Conference on Emerging Trends in Electrical Engineering and Energy Management (ICETEEEM), Chennai, 2012, pp. 222-228. [4] Subhransu Padhee, Abhinav Gautam, Yaduvir Singh, and Gagandeep Kaur, " A Novel Evolutionary Tuning Method for Fractional Order PID Controller", International Journal of Soft Computing and Engineering (IJSCE) ISSN: 2231-2307, Volume-1, Issue-3, July 2011. [5] Y. R. M. K. Maher M.F. Algreer, Design Fuzzy Self Tuning of PID Controller for Chopper-Fed DC Motor Drive, Al-Rafidain Eng., vol. 16, no. July, pp. 54–66, 2007. [6] Kumar S. Ray, Soft Computing and Its Applications, Volume Two: Fuzzy Reasoning and Fuzzy Control, Apple Academic Press- CRC Press, ISBN: 9781771880473. [7] T. Takagi and M. Sugeno, Fuzzy identification of systems and its applications to modeling and control, in IEEE Transactions on Systems, Man, and Cybernetics, vol. SMC-15, no. 1, pp. 116132, Jan.-Feb. 1985. [8] Ashwani Kharola1 , Dr SB Singh, Application Of Fuzzy Logic Reasoning Model For Determining Adhesive Strength Of Thin Flim Coatings, Annals of the Faculty of Engineering Hunedoara - International Journal of Engineering . Feb2015, Vol. 13 Issue 1, p217-221. 5p. [9] Adnan Shaout and Jaldip Trivedi, Performance Appraisal System – Using a Multistage Fuzzy Architecture, International Journal of Computer and Information, May 2013. [10] G. L. O. Serra and C. C. T. Ferreira, Takagi-Sugeno fuzzy control method for nonlinear systems, 2009 IEEE International Symposium on Computational Intelligence in Robotics and Automation - (CIRA), Daejeon, 2009, pp. 492-496. [11] L.K. Wong, F.H.F. Leung, P.K.S. Tam, Design of fuzzy logic controllers for Takagi–Sugeno fuzzy model based system with guaranteed performance, International Journal of Approximate Reasoning, Volume 30, Issue 1, 2002. [12] Onur KARASAKAL1, Engin YES ¸˙IL2, M¨ujde G¨UZELKAYA2, ˙Ibrahim EKS˙IN2, Implementation of a New Self-Tuning Fuzzy PID Controller on PLC, Turk J Elec Engin, VOL.13, NO.2 2005. [13] X. h. Liu and X. Li, Research on tension control system based on fuzzy self-tuning PID control, 2010 Chinese Control and Decision Conference, Xuzhou, 2010, pp. 3385-3390. [14] Lili Li and Yongxin Liu, Fuzzy PID with parameters self-turning used in the belt position departure control, 2010 International Conference on E-Health Networking Digital Ecosystems and Technologies (EDT), Shenzhen, 2010, pp. 349-352. [15] M. A. Shamseldin, A. A. EL-Samahy and A. M. A. Ghany, Different techniques of self-tuning FOPID control for Brushless DC Motor, 2016 Eighteenth International Middle East Power Systems Conference (MEPCON), Cairo, 2016, pp. 342-347.