4o. SBAI- Simpósio Brasileiro de Automação Inteligente, São Paulo, Sp, 08-10de Setembro de 1999 GENETIC AlGORITHMS IN THE PROJECT OF A PO ANO A FUZZY CONTROllER FOR SATElLlTE ATTITUOE CONTROl Cláudio Correa Sandra Aparecida Sandri Luiz Carlos Gadelha de Souza [email protected] [email protected] [email protected] Applied Computing - INPElCAP Laboratory of Computing and Applied Mathematics - INPElLAC Space Mechanics & Controls Division - INPElDMC Brazilian Nationallnstitute for Space Research - INPE Abstract - In this paper we propose the use of genetic algorithms in the project of a PD controller and a fuzzy controller for satellite attitude control. The simulated satellite model is based on the French-Brazilian micro satellite, whose control system is itselfbased on the stabilization of3 axes, using 3 reaction wheels as actuators. In the experiment, part of an orbit of the satellite is used to test the fitness of each candidate. The performance of the controllers are compared with a PD controller, projectcd previously using the poles allocation method. Keywords: Genetic A1gorithm, Fuzzy Control, Satellite . 1 INTRODUCTION There exists nowadays a tendency to build small artificial satellites, aiming at guaranteeing a fast and simple means of reaching space. The tendency is to have these satellites equipped with highly autonomous systems for altitude, maneuver and orbit control, and to have them developed fastly and at very Iow costs (Guerra et alo 1997). Moreover, an augmentation of sateIlite autonomy has been long pursued with the goal of not only improving the performance, but especia1ly in order to reduce fuel consumption. Fuzzy logic is one of the most well-succeeded recent technologies in the development of sophisticated controI systems (Driankov et alo 1996, Lee 1990). With its employment, complex requirements can be implemented in simpler controllers, of easy maintenance and Iow cost. In what regards autonomy, fuzzy controllers are especia1ly suited when the model is subject to uncertainty (Woodward 1996, Conway et ai. 1994, Guerra et ai. 1997). In this paper we present two altitude controllers, projected with the use of genetic algorithrns, for the pointing phase of a reaction wheel artificial satellite: a PD and a fuzzy controller of the Mandani type. The same fitness function was used in the genetic algorithms in order to leam the parameters for both controllers. The candidate sets in each experiment were tested using a previously developed simulator (Souza and Silva 1999), for a model similar to the French-Brazilian satellite, currently under development at the Brazilian National Institute for Space Research (INPE). This satelitte has its control system based on the stabilization of three axes and makes use of a proportional/derivative controller (PD), whose gains have been determined through the poles allocation method , and whose sensor measures have been processed by a Kalman filter (da Silva 1997). This PD controller is used as basis of comparison to assess lhe quality ofthe results obtained by the GA-based controllers presented here. This paper is divided as follows. In Section 2 we present some basic concepts about genetic algorithms and fuzzy controllers. In Section 3 we present lhe modeI of lhe satellite used in our applications, and the original PD altitude controller projected for it in the pointing phase . In Section 4 we present the PD and lhe fuzzy control1ers projected using genetic algorithms for the satellite modeI. Finally, Section 5 brings lhe conclusions. 2 BASIC NOTIONS 2.1 FuzzyContrai Fuzzy controllers are based on fuzzy sets theory, which has been developed since 1965 after the seminal works of Lotfi Zadeh (Zadeh 1965). Fuzzy controI techniques were fírst developed with the works of E.H . Mamdani (Zadeh 1976, Mamdani and Baaklini 1975), and have been gaining increasing importance over lhe years , being today the main application of fuzzy sets theory. The term fuzzy logic is usually employed in the controI field to name the modeling of fuzzy pieces of information and the inference mechanisms that act upon them. A fuzzy controller uses rules of the type I f < premíse > then < conclusion .>, which define controI actions in function of some (usually ill-defined) intervals on which the state variables may take their values. The definition of these intervals, modeled by fuzzy sets, constitute the main difficulty in the creation offuzzy controllers. One way of dealing with this problem is leam the set of such parameters through the use of genetic algorithms (GA) (Husbands 1992). In our context, the quality of each candidate set can be assessed by verifying lhe performance of the controller projected using that set. Contrary to what happens in conventional controI in which the control algorithm is described analytically by aIgebraic or differential equations, in fuzzy control logical mies are employed in the control algorithm, obtained through the synthetization of 496 40. SBAI - Simpósio Brasileiro de Automação Inteligente, São Paulo, SP, 08-10de Setembro de.1999 human experience, intuition and heuristics, in process control (Zadeh 1965) . (da Silva 1997): w= -Kp* , A role in a fuzzy controlleris usually of the type: If Xl =Al and Xz = Az ... and Xn = An ç= tv -J(D * (tv + Dk) + Tp(t) then y =B (1) 1\ where lhe X i and y are respectively state and controllinguistic variables, and lhe A i 's and B are linguistic terms. A linguistic variable is a 4-tuple (x, T(x), O, M), where x is lhe name of lhe variable, O is lhe domain of z, T(x) is a set of linguistic terms, i.e. a set of names of fuzzy sets, and M is a function that associates a fuzzy set in O to each term in T(x). . A fuzzy controller is composed of a knowledge base , that contains lhe roles and lhe linguistic variable descriptions, and an inference engine, that yields a control action in function of lhe value of lhe state varlables in a given moment of time. Fuzzy controllers are highly adaptable and capable of incorporating knowledge that many other systems are incapable of doing (Guerra 1998) . They are also versatile, especially when lhe physical model is very complex and of difficult malhematical reproduction. In general, they are more useful in non-linear systems , support very weIl perturbations and highly noisy plants, and are robust even in systems where uncertainty is intrinsically present. ç= (tv+Dk) ' 1\ where ç represents lhe estimation of rotation ç, tv represents lhe angular speed and Tp(t) represents lhe perturbation torques. Dk 1\ is given by Dk = bk- bk +n (0';), where bkrepresents lhe long periodbias (derive) and nk lhe short period bias (noise). The coordinate system for lhe satellite altitude control adopts an external referential, defined as: • ZE oriented to lhe north poIe of the ecliptic; • XE pointing to the sun position; • YE pointing in such a way as to form a destrogerous system. The following orbital data has been used: • Altitude at apogee 1500 km; • Altitude at perigee 400 km ; 2.2 Genetic Algorithms • Inclination of 7°; Genetic algorithms are adaptive search strategies based on a highly abstract model of biological evolution (Husbands 1992). They are primarily used in optimization problems for which one aims to find not necessarily an optimal solution, but at least a reasonably good one . • Argument at perigee of 90° ; • Longitude of lhe descending node of -90° ; • Mean anomaly of -90° . The satellite inertia moments for lhe 3 axes are : In these algorithms, individuaIs in a population (potential solutions) suffer a series of unary transformations (mutation) and of higher order (crossover). These individuals compete among themselves for survival; lhe most apt ones have better chances to be chosen to pass their characteristics to the next generation. After some generations, lhe algorithm usually converges with lhe best individual representing a solution elose to lhe optimum. • Ix = • Iv 7 kg.mê: = Iz = 10 kg.nr'. The project specifications are given by (da Silva 1997): The search for lhe solution involves an evaluation function (fitness) , which yields a grade for lhe performance of each individual, according to aspects considered relevant to lhe problem at hand. vi- = 0.5°, = v}.= 0.15°; Stability: vX = vy = vZ = 0.05 °. • Pointing precision: • In this paper, we have used a linear model for lhe sateIlite, once it is in lhe normal mode of operate, where lhe atittud angles are small (da Silva 1997). The attitude controller developed for this sateIlite uses lhe pole allocation method, and consists of a PD controlIer for each axis, using lhe foIlowing equation: Genetic algorithms have been used in many applications involving fuzzy control (Karr 1994, Pham and Karaboga 1991, Kinzel et ai. 1994, Aya and Costa J997); In lhe present work, lhe fitness function of lhe GA for lhe pointing phase is a global measure of lhe performance of each solution in rel átíon to lhe simulation of part of an orbit under a certain amount of perturbations. f(t) = Kp 3 SATELLlTE MOOEL ANO ORIGINAL PO CONTROLLER * e(t) + KD * where e(t) is lhe signaI error and Ãe(t) = KD are lhe proportional and derivalive gains. The French-Brazilian satellite model is a rigid body model where lhe inertia product is negIected. The controI system consists of a set of gyro, star and sun sensors plus a PD controller in lhe pointing phase. The rotational dynarnics of lhe sateIlite can be represented by the foIlowing differential equations system (2) 1t (e(t)), Kp and The proportional and derivative gains, for lhe X,Y and Z axes, are respectiveIy: 497 • Kpx = Kpy = 0.0263, Kpz = 0.0272; • K Dx = KDy = 0.08, KDz = 0.1. 40. SBAI - Simpósio Brasileiro de Automação Inteligente, São Paulo, Sp, 08-10 de Setembro de 1999 4 GA PROJECTED TROLLER ATTITUDE CON· Eixo'" EIxoZ In the following we present a PD and a fuzzy GA projected attitude controIlers for the satellite-pointing phase. We first present the simulation conditions used in both developments, and then present the controllers themselves. 4.1 -............... ... Simulation Conditions In order to effectively assess the quality of the controllers built with the GA's, severe conditions have been adopted for the satel- ' lite operation mode. In this sense, the magnitude order of the perturbations has been incremented in relation to those adopted to assess the quality of the original PD controller (da Silva 1997). The perturbations due to atmospheric drag and solar radiation pressure have been multiplied by constants f3a = 10 and f3. = 100 respectively, corresponding to the values necessary to reach the same order of magnitude of the perturbations due to the magnetic field, which had so far a predominant role over the other values (see Fig. I). ....... . .;,.,;,_.- , - ; Figure 2: Errors obtained with the use of the original PD controller. Moreover, ali candidate solutions yiolating either a position or a speed error project specification are disregarded: • eliminate chromosomes for which Wi least one ofthe axis i E {X, Y, Z}. > vi' or (i > vi in at The performance of each GA was studied using different fitness . functions. The best results were obtained using an approximation of the position error. The fitness function f is given by: =1- f -61 E i E{ X ,Y ,Z } 'max(;( t)dt f.'max W;(t)dt) (f.'o vf + =.:':u.O_",--_ vi where t m ax is the time taken by the simuIated orbits and the integral m ax g(t)dt of a funtion g(t) is obtained though the use of function trapz.m, available in Matlab (MathWorks 1992), which caIcuIates a numerical integral by the trapezoidal sum method. Jt: Figure 1: Perturbation torques multiplied by f3i. In alI the tests, the same pararoeters for the GA's have been maintained: population composed of 30 individuals , probability of crossover Pc = 0.9, probability of mutation Pm = 0.033, sensibiIity of 3 decimal cases to detect fitness variation and, as Iast stop criterium, a maximum number of 35 generations. Each chromosome is represented by a bit vector, with each gene (pararoeter) occupying 20 bits. The total size of a chromosome depends on the number of codified pararoeters. The satellite state vectors at the initial moment represent a zero error condition, in what regards both pointing and speed . In the present work, an error elose to the limits imposed by the project specifications has been adopted for the initial position of the 3 axes, with speed kept as in the original situation . The initial values for the 3 axes are: X = 0.35°, Y = -0.12° and Z = 0.12°. The attitude error relative to the control actions in the simulation of an orbit are shown in Fig. 2, calculated with the original PD controllaws (da Silva 1997). 4.2 Each chromosome was evaIuated in relation to the simulation of 1/4 of an orbit, corresponding to t m ax = 1600 seconds. 4.3 GA Characteristics GA Projected Controllers In each GA used in this work, each chromosome in a given population is composed of a set of pararoeters specifying a controller. The chromosomes for the PD controller contain the proportional and derivative gains, and in the case of the fuzzy controller, they contain the fuzzy terros employed by the roles . We have used the simuIation conditions and the GA structure described above to generate the gains of a PD controller, with a control law for each axis. Thus, 8 gains were codified in each chromosome. The GA converged afier 23 generations; the resuIts ofthis controller are shown in Fig. 3. In this work, a single fitness function has been employed to obtain optimized PD and fuzzy controller. In order to simplify the evaluation, only variables ( and w are used in the function . .The same GA parameters specification and fitness function were used to develop a fuzzy controIler of the Marodani type, using the fuzzy control tooIbox available in Matlab. 498 40. SBAI - Simpósio Brasileiro de Automação Inteligente, São Paulo, SP, 08-10de Setembro de'1999 ;, lã Set potn. Eixo X Sat pDlnt EI.oX EI.oV EI.oZ Bx:oY ElxoZ Figure 3: Errors obtained with the use of a PD controIler opti mizedbyaGA Figure 5: Errors obtained with lhe use of a fuzzy controller optímizedbyaGA A fixed set of9 rules was built through the observation ofthe PD controller. The chromosomes were used to encode the centers of the fuzzy terrns appearing in the premises and conclusion of the mIes . errors are nevertheless always under lhe specifications designo The fuzzy sets appearing at the extremities of their domains are trapezoidal and the remaining ones are triangular. AlI fuzzy sets are symmetrical in relation to O, and therefore, only the positive centers bad to be learn ed. To'confer more smoothness to the control surface, neighboring fuzzy sets were superposed. These restrictions do not limit the model, and have been frequently used in fuzzy controIlers (Driankov et ai. 1996, Heider et ai. 1995, Lar sen 1981, Sanchez et ai. 1997). We can also see that the errors yielded by CN-GA are smaller than in PD-PA and PD -GA for both position and speed, in aIl senses. Fig. 6 brings the output torques of PD-PA, PD-GA and CN-GA. We can observe lhe answer of PD-GA presents an increase in smoothness and a decrease of oscillations in relation to PD-PA. However, lhe torques of PD-GA are about 10 times greater than those yielded by PD-PA. This can be explained by the reduction of position and speed errors presented by PD-GA in relation to PD-PA (see Fig.s 2 and 3). To further reduce the number of parameters to be learned we have used a single control for alI the axes. The surface of best Mamdani fuzzy controIler obtained, with 3 fuzzy terms for each input variable (error and error derivative) and 3 fuzzy terms the output variable (torque), is depicted in Fig. 4. The results of this controIler are shown in Fig. 5. The fuzzy controIler CN-GA presents lhe ' best features. It presents a satisfactory reaction at lhe initial moment of simu lation (where lhe errors are greater) without provoking oscillations, and a1so maintains lhe errors lower than the other controIlers. 4.5 Robustness Analysis In order to verify the robustness of lhe projected controllers, one satelli te orb it was simulated, under lhe same conditions of optimizations, but with a 30% variation at the Y axis inertial mo- Table 1: Integral of lhe errors in relation to the 3 axes ABSCLUTE VALUE CF THE INTEGRAL (Trapezoidal method) Figure 4 : Fuzzy controlIer output torque. Errors Position Controller 4.4 Comparison AxisX PD-PA PD-GA CN-GA Controller PD-PA PD-GA CN-GA Table 1 below brings a comparison of the performance of the original controller (PD-PA) and lhe GA projected controllers (pD-GA and CN-GA) in terms of lhe sum of lhe errors yielded by each controller during the simulation of a complete orbit. We can see that the errors relative to PD -GA are smaller than the ones related to PD-PA, in total terms. That does not always happen, however, in what concerns lhe axes taken individually. The 499 78.1237 43.1680 17.3987 0.9383 0.6149 0.3584 AxisY AxisZ 84.5526 31.1589 12.6005 7.1152 16.5945 7.0337 Angular Speed 0.2972 0.3276 0.4463 0.3818 0.1260 0.1280 Total 193.8354 62.8839 41.0269 1.5632 1.4432 0.6125 40. SBAI- Simpósio Brasileiro de Automação Inteligente, São Paulo, SP, 08-10 de Setembro de 1999 :·.•;. o,rig,net..' .. Setpolnt EluX EI.oY ElloZ -:-, .t.: . ....,. . .' ,;', . -;..;S." _ : r; . _, . .... . l· : . :<:.:.. .. . ,..: ; ",.:.':.' . '. - . .', .; -, .. . :/r·:.. '.:: .,.: Figure 7: Angular errors of the PD-PA controller and 30% variation in Y inertial moment. ..:: /;: ,..;..' Slt'• EJxoX Eixo V EIxoZ .",- :. " d.'.. .: , I Figure 6: Output torques: a) PD-PA b) PD-GA c) CN-GA. ment. Table 2 shows the results of the angular errors for position and speed, obtained through the simulation of one orbit: Table 2: Integral ofthe errors, with a 30% variation ofthe Y axis inertial moment INTEGRAL OF THE ERRORS WITH 30% VARIATION Y AXIS INERTIAL MOMENT Errors Position Controller AxisX PD-PA PD-GA CN-GA 78.1237 43.1680 17.3987 Controller PD-PA PD-GA CN-GA Figure 8: Errors obtained with the PD-GA controIler and 30% variation in Y inertial moment. 0.9383 0.6149 0.3584 AxisY AxisZ 120.1006 31.1589 17.5652 7.1152 23.1204 7.0337 Angular Speed 0.3339 0.2972 0.6149 0.3818 0.1286 0.1280 Total exception of the original PD controller, which, similar to the previous simulations presents a certain dificult to maintain the erros dose to zero at the end of one orbit simulation, alI the other controllers maintained the pointing, even with this change in the inertial moment. 229.3834 47.5528 41.0269 1.5696 1.4436 0.6151 Among lhe projected controllers, we can observe that the second Marndani model is slightly more sensible to variations, as can be varified through the' error results in axes X and Z, which also suffered a small alteration. However, contrary to what happenned in the Y axis, the angular error values of position and speed in these others axes are even smaller when compared to the values presented in Table 1. Figures 7,8 and 9 correspond to these simulations. We can ob-serve, in a graphical manner, the efficiency of each controller in the task of maintaining the pointing under this new condition. The reactions of the controllers, in relation to the Y axis mass variation, are similar, and all the controllers presented an increase of errors in relation to the Y axis, It should be noted, that to maintain the error results inside the project especifications is not a complex task, even under the test circumstances, since the model sattellite has a relatively simple structure, and neither flexible panels nor other appendices have been considered. However, we can observe, through the graphics and the results in Table 2, that the stability characteristics necessary during the nominal operation regime remain practicalIy unaltered. With the 500 I I i 40. SBAI- Simpósio Brasileiro de Automação Inteligente, São Paulo, Sp,08-10de Setembro de··1999 . • .' ,,,"<!( -- ---___ __ ....... ...... ..... da Silva, A R. (1997) . Estudo de sistema de controle de um satélite artificial durante a fase de transferência orbital e apontamento. Msc Thesis IJIlPE-6397-TDII613. INPE - S. J. Campos. Setpol ElxoZ Driankov, D ., H. Hellendoom and M . Reinfrank (1996). An introduction to fuzzy controloSpringer-Verlag TELOS. .. Guerra, R. (1998). Projeto e simulação do controle de atitude autônomo de satélites usando lógica nebulosa. Msc Thesis INPE-6714-TDII630.INPE - S. 1. Campos. ,;,. _- Guerra, R., S. A Sandri and M . L. O. Souza (1997). Dynamics and design of autonomous attitude control of a satellite using fuzzy logic. In : Proc. COBEM'97. Bauru-SP. Heider, H., V. Tryba and E. Mühlenfeld (1995). Automatic design offuzzy systems by genetic algorithms. Fuzzy Logic and Soft Computing. World Scientific, 21-28. Husbands, P. (1992). Genetic algorithms in optimization and adaptation. Blackwell Scientific Publications. Figure 9: Errors of the first CN-GA model obtained with a 30% variation in Y inertial moment. 5 Karr, Co (1994). In: Adaptive control with fuzzy logic and genetic algorithms (R. R. Yager and L. A zadeh, Eds.). Van. Nostrand Reinhold, pp . 345-367. CONCLUSIONS We have presented a PD and a fuzzy controller for attitude control for the pointing phase of a satellite model, whose parameters have been obtained through the use of a genetic algorithm. KinzeI , 1., F. KIawonn and R. Kruse (1994). In : Modifications of genetic algorithms for designing and optimizing fuzzy controlers. I Proc. of lhe IEEE Int. Conf. on Evolutionary Computation. Orlando-FI. pp. 28-33. We have shown that the controllers thus obtained are robust, and Larsen, P. M. (1981). Industrial aplications offuzzy logic control. Fuzzy Reasoning and its Aplications. London: Academic Press Inc., 335-342. the results produced validate the use of genetic algorithms as an optimization tool to treat similar problems as those addressed in this work. Lee, C. C. (1990). Fuzzy Iogic in controI systems: Fuzzy logic controller (pari i). IEEE Transactions 011 Systems, Man an Cybernetics 20(2), 404-418. We envisage the development of a more complete fitness function. A hypothesis to be cons idered is to take the variance of the output signal of the controller, in order to augment the sensibility in what regards oscillations. Predictions of the energy consumed due to lhe controller action could also be taken into account in the function . Mamdani, E. H. and N. Baaklini (1975). Prescriptive method for deriving controI policy in a fuzzy Iogic controller. Eletronic Letters 11, 625-626. The satellite model used here is a very simple one for which other kinds of controllers alsopresent very good results. However, the framework proposed here may be very usefuI in situations for which other controllers do not yield good results or are toa difficult to build . The project reported in this work (Correa 1999) also included the criation of a user-friendly interface that can be used for prototyping and for educational purposes. MalhWorks, The (1992). The student edition of MATLABTM: Student user guide. Prentice Hall . Englewood Cliffs. Pham, D. T. and D. Karaboga (1991). Optimum design offuzzy logic controllers using genetic algorithms. J. Syst. Eng. 1,114-118. Sanchez, E., T. Shibata and L. A Zadeh (1997). Genetic algoritms andfuzzy logic systems: soft computing perspectives. Singapore: World Scientific Publishing Co . PIe. LId. REFERENCES Aya, J. C. C. and O. L. V. Costa (1997). In: Otimização de controladores nebulosos usando algoritmos genéticos. Proc -. SBAI'97. Vitória. pp. 207-212. Souza, L. C. G. and A. R. Silva (1999). French-brazilian microsatellite control system design during normal mode. In: VIII Applied Mechanics in the Americas. H. I. Webwer and P.B. Gonçalves and I. Jasiuk and D . Pamplona and . C. Steele and L. Bevilacqua. Rio de Janeiro-RI. pp. 11631166, ISBN: 85-900726-2-2. Conway, D., R. Sperling, D. Folta, K. Richon and R. DeFazio (1994) . Automated maneuver planning using afuzzy logic controller. Proc. Guidance: Navigation and ControI Conf.. San Diego-CA Woodward, M . A (1996) . Fuzzy open-loop attitude control for the FAsr spacecraft. Proc. NASA AIAA, Guidance, Navigation and Control Conf.. San Diego-CA. Zadeh , L. A. (1965). Fuzzy sets, information and controI. 8,338-353. Correa, Cláudio (1999). Uso de algoritmos genéticos na con strução de controlador nebuloso para o .controle de atitude de um satélite artificial durante a fase de apontamento. INPE/CAP. São José dos Campos. Zadeh, L. A. (1976) . Advances in lhe linguistic syntesis offuzzy controlIers. Int. J. Man-Mach. Stud. 8, 669-678. 501