Design, Implementation and Verification of the Attitude Determination and Control Algorithms for the DelFFi Satellites Master of Science Thesis Morteza Haghayegh Space Systems Engineering Design, Implementation and Verification of the Attitude Determination and Control Algorithms for the DelFFi Satellites Master of Science Thesis For the degree of Master of Science in Space Systems Engineering at Delft University of Technology Morteza Haghayegh August 31, 2015 Faculty of Aerospace Engineering (AE) · Delft University of Technology c Spaceflight Copyright All rights reserved. Abstract This thesis is about the design, implementation and verification of the Attitude Determination and Control (ADC) algorithms for the DelFFi satellites. The DelFFi satellites are two satellites that are being developed for the DelFFi mission as part of the Delfi program. In contrast to a passive control system, an active attitude determination and control system has been chosen for the DelFFi satellites in order to fulfil the pointing requirements of the DelFFi mission. The goal of this thesis is to answer the following two research questions: • What are the performance issues associated with the ADC algorithms in case of nominal, non-nominal and practical conditions? • What are the sources of errors when running the ADC algorithm on the microcontroller and how can these be mitigated? The first research question has been answered by developing a spacecraft dynamics and space environment model (also referred to as the simulation environment), designing the ADC algorithms and running the simulation of the ADC algorithms using the simulation environment for varying conditions. The second research question has been answered by verifying the ADC algorithms using a software-in-the-loop test and a test on the processor. The ADC algorithms consist of the mode determination algorithm and the algorithm of the four modes, namely the detumble mode, velocity-pointing mode, thrust vector control mode and safe mode. The thrust vector control mode will be designed at a later stage of the project. The analysis of the simulation results of the detumble mode shows that there is a certain optimum measurement update frequency. Moreover, it has been shown that the detumble mode is robust enough to cope with an increase in aerodynamic drag and sensor measurement noise. However, analysis shows that a failure around certain axes will cause the satellite to continue tumbling. An analysis has also been performed on the simulation results of the velocity-pointing mode. It has been found that for a larger inaccuracy than nominal of the IGRF look-up table, the EKF will have poor performance. However, an inaccuracy of the measured moment of inertia does not decrease the EKF performance. Moreover, it has been shown that the velocity-pointing mode is not sufficient for accurate pointing of the thrusters. Running a software-in-the-loop test and a test on the processor has shown that the C code of the ADC algorithms require some modifications in order to function correctly. These modifications include changes in the coding architecture and rewriting of Simulink functions. These tests have shown that the ADC algorithms can run without errors on the processor after these modifications have been implemented in the code of the ADC algorithms. Master of Science Thesis Morteza Haghayegh ii Morteza Haghayegh Master of Science Thesis Table of Contents Acknowledgements xiii 1 Introduction 1-1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1-2 The Objectives of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1-3 Research Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1-4 Thesis Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Attitude Determination and Control Subsystem of the DelFFi Satellites 5 2-1 Introduction to the DelFFi Mission . . . . . . . . . . . . . . . . . . . . . . . . . 2-1-1 Delfi Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1-2 5 5 QB50 Program and the DelFFi Mission . . . . . . . . . . . . . . . . . . 5 2-2 Orbit and Satellite Properties of the DelFFi Mission . . . . . . . . . . . . . . . . 6 2-3 Hardware . . . . . . . . . . 2-3-1 Attitude Sensors . . 2-3-2 Attitude Actuators . 2-4 Mode Switch Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 9 10 2-4-1 Mode Switch Logic Defined by the DelFFi Team . . . . . . . . . . . . . 10 2-4-2 Mode Switch Logic Defined for this Thesis . . . . . . . . . . . . . . . . . 10 2-5 Timing Sequence of the ADCS . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2-6 Overview of the ADC Algorithms and the Simulation Environment . . . . . . . . 14 3 Dynamics and Kinematic Models and Enviroment Modelling 15 3-1 Common Spacecraft Reference Frames . . . . . . . . . . . . . . . . . . . . . . . 15 3-2 Transformation Between Reference Frames . . . . . . . . . . . . . . . . . . . . . 3-2-1 Transformation ECI frame to ECEF frame . . . . . . . . . . . . . . . . . 3-2-2 Transformation ECI frame to T frame . . . . . . . . . . . . . . . . . . . 17 18 18 Master of Science Thesis Morteza Haghayegh iv Table of Contents 3-2-3 Transformation ECI frame to O 3-3 Rotational Kinematics . . . . . . . . . 3-3-1 Direction Cosine Matrix . . . . 3-3-2 Euler Angles . . . . . . . . . . . . . . 21 22 23 24 Quaternion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Kinematic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 26 3-4 Euler’s Dynamic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3-5 Spacecraft Orbit Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3-6 Environment Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3-3-3 3-3-4 frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6-1 Model of the Geomagnetic Field . . . . . . . . . . . . . . . . . . . . . . 28 3-6-2 Model of the Sun’s position . . . . . . . . . . . . . . . . . . . . . . . . . 30 3-6-3 Model of the Disturbance Torques . . . . . . . . . . . . . . . . . . . . . 31 3-7 Sensor and Actuator Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7-1 Magnetometer Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . 35 35 3-7-2 Sun Sensor Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3-7-3 Magnetic Torquer Modelling . . . . . . . . . . . . . . . . . . . . . . . . 35 4 Design of the Algorithms 39 4-1 Tumble Parameter Determination Algorithm . . . . . . . . . . . . . . . . . . . . 39 4-2 Attitude Estimation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4-3 Control Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4-3-1 4-3-2 Detumble Mode Control . . . . . . . . . . . . . . . . . . . . . . . . . . Velocity-pointing Mode Control . . . . . . . . . . . . . . . . . . . . . . . 45 46 4-4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5 Simulation Results 5-1 Detumble Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1-1 Performance Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 51 51 5-2 Velocity-pointing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5-2-1 Tuning Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 5-2-2 Performance Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5-3 Requirement Verification and Recommendations . . . . . . . . . . . . . . . . . . 71 6 Testing of the ADC Algorithm 73 6-1 Software Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Algorithm Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 74 6-2-1 Software-in-the-loop Testing . . . . . . . . . . . . . . . . . . . . . . . . 74 6-2-2 Testing the ADC Algorithm on the Processor . . . . . . . . . . . . . . . 81 6-3 Recommended Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Conclusions & Recommendations Morteza Haghayegh 84 87 Master of Science Thesis Table of Contents v A DelFFi ADCS Requirements 91 A-1 List of Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 A-2 ADCS Requirements of the DelFFi Mission . . . . . . . . . . . . . . . . . . . . . 96 B Additional Equations, Derivations and Functions 97 B-1 Arccosine2 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2 Angular Pointing Error and Angular Estimation Error . . . . . . . . . . . . . . . 97 97 Bibliography 99 Master of Science Thesis Morteza Haghayegh vi Morteza Haghayegh Table of Contents Master of Science Thesis List of Figures 1-1 The simulation loop of the ADC algorithm and the simulation environment [1] . 3 2-1 Structure of the DelFFi Satellites [2] . . . . . . . . . . . . . . . . . . . . . . . . 6 2-2 Mode switch logic of the attitude modes as defined by the DelFFi team . . . . . 11 2-3 Mode Switching Logic for the Attitude Determination and Control algorithms of the DelFFi satellites (* = this mode will not be discussed in this thesis) . . . . . 13 2-4 overview of the ADC algorithms and the simulation environment . . . . . . . . . 14 3-1 ECI reference frame [3] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3-2 ECEF reference frame [3] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3-3 Sun pointing reference frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3-4 Thrust pointing reference frame 17 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 First rotation for the transformation from ECI reference frame to Thrust-pointing reference frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 Second rotation for the transformation from ECI reference frame to Thrust-pointing reference frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 First rotation for the transformation from ECI reference frame to Orbit reference frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 Second rotation for the transformation from ECI reference frame to Orbit reference frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 Third rotation for the transformation from ECI reference frame to Orbit reference frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10 Geomagnetic Field represented as a dipole [4] . . . . . . . . . . . . . . . . . . . 19 20 22 23 24 29 3-11 Eclipse occurrence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3-12 Graph of the air density versus the altitude for a varying solar flux [5] . . . . . . 32 3-13 Thruster misalignment overview . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3-14 Hysteresis curve of a round loop [6] . . . . . . . . . . . . . . . . . . . . . . . . 37 3-15 Hysteresis curve of a flat loop [6] . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Master of Science Thesis Morteza Haghayegh viii List of Figures 4-1 Overview of the Extended Kalman Filter . . . . . . . . . . . . . . . . . . . . . . 4-2 Overview of the Attitude Determination and Control Algorithm . . . . . . . . . . 42 49 5-1 Geomagnetic field vector expressed in the B frame for ω0 = 10 deg/s (Case E) . 54 5-2 Geomagnetic field vector expressed in the B frame for ω0 = 60 deg/s (Case E) . 54 5-3 Angular velocity of the satellite with respect to I frame for ω0 = 10 deg/s (timing sequence = case E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5-4 Angular velocity of the satellite with respect to I frame for ω0 = 60 deg/s (timing sequence = case E) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5-5 Angular velocity of the satellite with respect to I frame (Case L) . . . . . . . . . 57 5-6 Tumble parameter Ptumble (Case L) . . . . . . . . . . . . . . . . . . . . . . . . 57 5-7 Angular velocity of the satellite with respect to I frame (Case M1) . . . . . . . . 58 5-8 Angular velocity of the satellite with respect to I frame (Case M2) . . . . . . . . 58 5-9 Angular velocity of the satellite with respect to I frame (Case M3) . . . . . . . . 58 5-10 Angular velocity of the satellite with respect to I frame (Case M4) . . . . . . . . 58 5-11 Angular velocity of the satellite with respect to I frame (Case M5) . . . . . . . . 59 5-12 Angular velocity of the satellite with respect to I frame (Case M6) . . . . . . . . 59 5-13 Angular Estimation Error in [deg] of case A . . . . . . . . . . . . . . . . . . . . 61 5-14 Angular Estimation Error in [deg] of case B . . . . . . . . . . . . . . . . . . . . 61 5-15 Angular Estimation Error in [deg] of case C . . . . . . . . . . . . . . . . . . . . 61 5-16 Angular Estimation Error in [deg] of case D . . . . . . . . . . . . . . . . . . . . 61 5-17 Angular Estimation Error in [deg] of case E . . . . . . . . . . . . . . . . . . . . 62 5-18 Angular Estimation Error in [deg] of case F . . . . . . . . . . . . . . . . . . . . 62 5-19 Angular Estimation Error in [deg] of case G . . . . . . . . . . . . . . . . . . . . 62 5-20 Angular Estimation Error in [deg] of case H . . . . . . . . . . . . . . . . . . . . 62 5-21 Angular Pointing Error of case I . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5-22 Angular Pointing Error of case J . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5-23 Angular Pointing Error of case K . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5-24 Angular Pointing Error of case L . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5-25 Angular Pointing Error of case M . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5-26 Angular Pointing Error of case N . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5-27 Angular Estimation Error of a case with nominal conditions . . . . . . . . . . . . 66 5-28 Angular Pointing Error of a case with nominal conditions . . . . . . . . . . . . . 66 5-29 Angular Pointing Error of case P . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5-30 Angular Estimation Error of case Q1 . . . . . . . . . . . . . . . . . . . . . . . . 68 5-31 Angular Pointing Error of case Q1 . . . . . . . . . . . . . . . . . . . . . . . . . 68 5-32 Angular Estimation Error of case Q2 . . . . . . . . . . . . . . . . . . . . . . . . 68 5-33 Angular Pointing Error of case Q2 . . . . . . . . . . . . . . . . . . . . . . . . . 68 Morteza Haghayegh Master of Science Thesis List of Figures ix 5-34 Angular Estimation Error of case R . . . . . . . . . . . . . . . . . . . . . . . . . 69 5-35 Angular Pointing Error of case R . . . . . . . . . . . . . . . . . . . . . . . . . . 69 5-36 Angular velocity of case S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5-37 Angular Pointing Error of case S . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5-38 Angular Pointing Error of case S. Zoomed in on the last thrusting period . . . . 71 6-1 Visualisation of the SIL test set-up for case A . . . . . . . . . . . . . . . . . . . 75 6-2 Visualisation of the SIL test set-up for case B1 . . . . . . . . . . . . . . . . . . 75 6-3 Visualisation of the SIL test set-up for case B2 . . . . . . . . . . . . . . . . . . 76 6-4 Visualisation of the SIL test set-up for case C . . . . . . . . . . . . . . . . . . . 77 6-5 Visualisation of the SIL test set-up for case D . . . . . . . . . . . . . . . . . . . 77 6-6 Rotational rate in case A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Mode determination variable in case A . . . . . . . . . . . . . . . . . . . . . . . 6-8 Angular Estimation Error in case A . . . . . . . . . . . . . . . . . . . . . . . . . 77 77 78 6-9 Angular Pointing Error in case A . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6-10 Rotational rate in case B1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Mode determination variable in case B1 . . . . . . . . . . . . . . . . . . . . . . 6-12 Angular Estimation Error in case B1 . . . . . . . . . . . . . . . . . . . . . . . . 79 79 79 6-13 Angular Pointing Error in case B1 . . . . . . . . . . . . . . . . . . . . . . . . . 79 6-14 Accuracy of the commanded magnetic dipole moment (case B2) . . . . . . . . . 80 6-15 Rotational rate in case D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16 Mode determination variable in case D . . . . . . . . . . . . . . . . . . . . . . . 6-17 Hardware-in-the-loop testing of the ADC algorithm . . . . . . . . . . . . . . . . 81 81 85 Master of Science Thesis Morteza Haghayegh x Morteza Haghayegh List of Figures Master of Science Thesis List of Tables 2-1 Orbit and satellite properties of the DelFFi mission . . . . . . . . . . . . . . . . 7 2-2 Key characteristics of the magnetometers [7] . . . . . . . . . . . . . . . . . . . . 8 2-3 Key characteristics of the Sun sensors [7] . . . . . . . . . . . . . . . . . . . . . . 8 2-4 Key characteristics of the magnetic torquer (MTQ) system [7] . . . . . . . . . . 9 2-5 Key characteristics of the reaction wheel system [8] . . . . . . . . . . . . . . . . 9 2-6 New ADCS requirements for the DelFFi satellite (* = this mode will not be discussed in this thesis) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3-1 Table of the air density for varying solar flux conditions and highest and lowest altitude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4-1 List of most commonly used filters in the field of spacecraft attitude estimation. . 42 5-1 Overview of the cases for determining the optimal timing sequence interval . . . 52 5-2 Parameters used in the simulations for finding the optimal timing sequence interval 53 5-3 Parameters used for the detumble mode . . . . . . . . . . . . . . . . . . . . . . 5-4 Results of the simulations of the detumble mode for varying timing sequence intervals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5 Overview of the cases for the performance investigation of the Detumble mode. The values used in this table are obtained from the orbit and satellite properties table (table 2-1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 53 55 5-6 Results of the performance of the detumble mode for non-nominal conditions of the last 15 minutes for total simulation time of 8 orbits using Monte Carlo simulations. All values given in deg/s unless otherwise stated. . . . . . . . . . . . . . . . . . 57 5-7 Attitude estimation parameter tuning cases . . . . . . . . . . . . . . . . . . . . 60 5-8 Control gain parameters tuning cases . . . . . . . . . . . . . . . . . . . . . . . . 60 5-9 Filter parameters used on the Delfi-n3Xt mission . . . . . . . . . . . . . . . . . 60 5-10 Mean values of the Monte Carlo simulations for cases I to N . . . . . . . . . . . 64 Master of Science Thesis Morteza Haghayegh xii List of Tables 5-11 Mean value of the angular pointing error of the last 10 minutes before the last eclipse (or in case S, before the last thrusting period) for a simulation of 5 orbits 69 6-1 Results of the quaternion obtained from the EKF in case A and in case C . . . . 80 6-2 Overview of the Simulink functions used in the ADC algorithms . . . . . . . . . 82 6-3 Angular estimation error [deg] during Sunlit phase between the second last and last eclipse for a Simulink simulation of 7 orbits . . . . . . . . . . . . . . . . . . 83 6-4 Output of algorithm in Simulink using the standard matrix exponential simulink block and an approximation to the matrix exponential function . . . . . . . . . . 84 A-1 DelFFi Requirements Specification List Part 1 [9] . . . . . . . . . . . . . . . . . 92 A-2 DelFFi Requirements Specification List Part 2 [9] . . . . . . . . . . . . . . . . . 93 A-3 DelFFi Requirements Specification List Part 3 [9] . . . . . . . . . . . . . . . . . 94 A-4 DelFFi Requirements Specification List Part 4 [9] . . . . . . . . . . . . . . . . . 95 A-5 ADCS Requirements DelFFi Mission ([9]) . . . . . . . . . . . . . . . . . . . . . 96 Morteza Haghayegh Master of Science Thesis Acknowledgements I would like to express my gratitude to dr. Guo, my thesis supervisor, for his guidance and useful critique of this thesis work. Moreover, I would like to thank Nuno Baltazar dos Santos for providing the necessary hardware to run tests on and Jaan Viru for his assistance in using the hardware. I would also like to thank Xiaoxiang Liu and the DelFFi team for providing useful critique in designing the model. Furthermore I wish to express my gratitude to Emanuelle de Angelis for his guidance in simulating control algorithms in Simulink during my internship at ALMASpace . Finally, I would like to thank my parents for their support and encouragement throughout my study. Delft, University of Technology August 31, 2015 Master of Science Thesis Morteza Haghayegh Morteza Haghayegh xiv Morteza Haghayegh Acknowledgements Master of Science Thesis Acronyms ADC ADCS AEKF CDHS CPU DCM ECEF ECI EKF IGRF LQR MEKF MM MTQ OBC OF PCB PD PF PIL QUEST QFR RW SGP4 SIL SIM SL Attitude Determination and Control Attitude Determination and Control Subsystem Additive Extended Kalman Filter Command and Data Handling Subsystem Central Processing Unit Direction Cosine Matrix Earth Centered Earth Fixed Earth Centered Inertial Extended Kalman Filter International Geomagnetic Reference Field Linear Quadratic Regulator Multiplicative Extended Kalman Filter Magnetometer Magnetic Torquer On-Board Computer Orthogonal Filter Printed Circuit Board Proportional Differential Particle Filter Processor-in-the-loop Quaternion Estimator Quaternion Feedback Regulator Reaction Wheel Simplified General Perturbations Model 4 Software-in-the-loop Simulation Service Layer Master of Science Thesis Morteza Haghayegh xvi SS TLEs TVC UKF VP Acknowledgements Sun Sensor Two Line Elements Thrust Vector Control Unscented Kalman Filter Velocity-pointing Morteza Haghayegh Master of Science Thesis Nomenclature ˙ () ˆ () [()×] ()0 ()σ ()avg ()b ()B ()d ()e ()E ()EKF ()i ()i+1 ()I ()k/k) ()k+1/k) ()k+1/k+1) ()m ()max,ef f ()max,theoretical ()n ()O ()S ()T α α σSS σM M σq σω First time derivative of a parameter Estimate of a parameter Skew-symmetric matrix of a vector Initial value of a parameter Standard deviation of a parameter Average value of a parameter The bias of a parameter A vector expressed in the body fixed reference frame Desired value of a parameter The error of a parameter A vector expressed in the Earth Centered Earth Fixed reference frame The parameter obtained from the Extended Kalman Filter A parameter at time step i A parameter at time step i+1 A vector expressed in the Earth Centered Inertial reference frame A parameter at time step k given the parameter at time step k A parameter at time step k+1 given the parameter at time step k A parameter at time step k+1 given the parameter at time step k+1 The measured value of a parameter Effective maximum value of a parameter Theoretical maximum value of the parameter The noise of a parameter A vector expressed in the orbit fixed reference frame A vector expressed in the Sun Pointing reference frame A vector expressed in the Thrust Pointing reference frame Low-pass filter constant angle Process noise of the Sun sensors Process noise of the magnetometer Processor noise of the quaternion Process noise of the angular velocity Master of Science Thesis Morteza Haghayegh xviii γE θ θ φ ρ ω ∆ ∆t a B dy dz DO e eallowed E Fthruster F H H I i J JEKF Jmeasured J k kb Kd Kp Ku K L Ldetumbled Lx m mmtq mmax,ef f mmax,theoretical M Mthruster n P P Ptumble P Morteza Haghayegh Acknowledgements Angle between the ecliptic plane and the equatorial plane Earth’s half angular size from the orbit of DelFFi True Anomaly Colatitude Longitude Air density Angular velocity Difference between two values Time to complete one loop Semi-major axis Magnetic field vector Length in y direction Length in z direction Drag expressed in the Orbit fixed reference frame Eccentricity Allowed relative error Eccentricity Anomaly Force produced by the thruster Jacobian matrix Angular Momentum Observation matrix Identity matrix inclination Moment of Inertia Moment of inertia inserted in the EKF Measured moment of inertia Loss function Counting element Bdot controller gain Derivative gain Proportional gain Ultimate gain Kalman gain Length of the state vector Detumble limit Length of the satellite Magnetic dipole moment Magnetic dipole moment produced by the magnetic torquers Maximum effective magnetic dipole moment produced by the magnetic torquers Maximum theoretical magnetic dipole moment produced by the magnetic torquers Mean Anomaly Disturbance torque produced by the thruster around all three axis Orbital speed Tumble parameter Variable gain of the LQR Tumble parameter Estimation error covariance matrix Master of Science Thesis xix q Q Qc r rcp R R Rc S t-tev tdetumbled tactuator ttotal T Tc Td Tg Tmtq Torb Ts Tu Tx Ty Tyear Tz U u v V w x Quaternion Process noise matrix covariance matrix Vector pointing from center of the Earth to the satellite in meters Distance between center of gravity and center of pressure Rotation matrix Sensor noise matrix covariance matrix Sun pointing vector Time since last alignment of Sun direction with the Vernal Equinox given in seconds. Time that tumble parameter needs to be below detumble limit to ensure satellite is detumbled Period of time where the actuators are on Total time of one control loop Torque Control torque Disturbance torque Gravity Gradient Torque Torque produced by the magnetic torquers Time to complete one orbit Settling time Oscillation period Transformation matrix around the x axis Transformation matrix around the y axis Time in seconds in one year Transformation matrix around the z axis Perturbed moment of inertia Control torque output vector Velocity vector Non-negative weights state vector Master of Science Thesis Morteza Haghayegh xx Morteza Haghayegh Acknowledgements Master of Science Thesis Chapter 1 Introduction Within the framework of the Delfi program, Delft University of Technology has been developing two satellites for the DelFFi mission. The objective of the DelFFi mission is to demonstrate formation flying and to perform in-situ measurements in the lower thermosphere. For this mission the Attitude Determination and Control Subsystem (ADCS) will be critical in order to point the thruster and the instruments in the correct direction for formation flying and performing in-situ measurements, respectively. The ADCS of a satellite is the subsystem that provides the capability to determine the current orientation of the satellite and control the actuators to change this orientation in order to reach a desired attitude. In this thesis the attitude determination and control (ADC) algorithms of the DelFFi satellite will be designed and verified. The focus of this thesis will therefore be: Design, Implementation and Verification of the Attitude Determination and Control Algorithms for the DelFFi satellites 1-1 Background The Delfi program aims to develop Cubesats at the Delft University of Technology, to provide hands-on education and training of students as well as technology demonstration for Dutch space industry and research and development on the nano-satellite spacecraft bus. Delft University of Technology will develop and launch nano-satellites on a regular basis to ensure continuity of the program as much as possible. The Delfi program started with the design and launch of the Delfi-C3 satellite on April 2008. The main objective of the Delfi-C3 mission is to provide hands-on education and training of students on a real spacecraft project, demonstration of four solar arrays for Dutch Space, demonstration of Sun sensors from TNO, testing of a radio amateur platform of TU Delft, development of a modular nano-satellite spacecraft bus and a distributed ground segment. In order to meet these objectives, the ADCS of the Delfi-C3 did not have to be advanced. It was chosen to use a passive magnetic attitude control system. This system will not actively control the attitude of the spacecraft, but it will Master of Science Thesis Morteza Haghayegh 2 Introduction use magnetic hysteresis material and a permanent magnet to limit the rotation rate of the spacecraft. The next project of the Delfi program is the Delfi-n3Xt mission which launched the Delfi-n3Xt satellite in November 2013. One significant improvement of the Delfi-n3Xt compared to the Delfi-C3 is the active ADCS. The active ADCS of the Delfi-n3Xt satellite consists of six Sun sensors, a triple-axis magnetometer, 3 reaction wheels and triple axis magnetic torquer. Active ADCS is mainly important for advanced mission requirements, such as precise imagery of the Earth, thruster pointing for orbit manoeuvres, antenna pointing for communication with ground stations and many more applications. For the DelFFi mission, the heritage of the Delfi-C3 and Delfi-n3Xt will be used. 1-2 The Objectives of the Thesis The objective of this thesis is to design, implement and verify the attitude determination and control algorithm which will run on the DelFFi satellite. The ADC algorithm will be robust and it will need to have the capability to meet the detumbling requirements or the pointing requirements, depending on the mode. The ADC algorithm will not only be tested during nominal conditions, but also during practical and non-nominal conditions. These practical and non-nominal conditions are high noise in the magnetometer measurements, magnetic torquer failure, increase in the distance between the center of gravity and center of pressure, inaccurate values in the IGRF table, inaccurate determination of the moment of inertia and thruster firing. In order to meet the objective, the following research questions have been formulated: • What are the performance issues associated with the ADC algorithm in case of nominal, non-nominal and practical conditions? • What are the sources of errors when running the ADC algorithm on the microcontroller and how can these be mitigated? 1-3 Research Methodology The design, implementation and verification of the ADC algorithm for the DelFFi satellite can be split up into several parts. Firstly, the simulation environment will be designed. This simulation environment will provide the space environment model and the model of the spacecraft dynamics to determine the behaviour of the satellite. The space environment models and the model of the spacecraft dynamics will consist of the following: • Vehicle attitude dynamics • Orbit dynamics • Model of the disturbance torques • Model of the physical world Morteza Haghayegh Master of Science Thesis 1-4 Thesis Structure 3 Figure 1-1: The simulation loop of the ADC algorithm and the simulation environment [1] Using these models the position, velocity and attitude of the satellite will be determined. It should be noted that the simulation environment is not part of the ADC algorithm, but it is essential for simulating the functioning of this algorithm. Secondly, the ADC algorithm will be designed. A trade-off of the attitude determination and control methods will be conducted to select the most suitable method. Thirdly, the algorithm will be simulated using the simulation environment. This simulation will be used to check whether the detumbling and pointing requirement have been met. Moreover, the simulation will also run for practical and non-nominal conditions. Figure 1-1 shows one loop of the simulation. Lastly, the algorithms will be converted to C code and they will be verified using a softwarein-the-loop simulation and a test on the processor. The SIL test will verify whether the algorithm meets the detumbling requirement and the pointing requirement. A correct functioning algorithm might still behave differently when running on a processor. Therefore it is necessary to verify the functioning of the algorithm on the processor. 1-4 Thesis Structure This thesis report will start off by providing a short introduction to the QB50 program and the Delfi program in chapter 2. In addition, this chapter will also provide the ADCS requirements and sensor and actuator characteristics. Furthermore, top-level design aspects of the mode switch logic and the timing sequence of the ADCS will be discussed. Chapter 3 will give the spacecraft dynamics and kinematics model, the common spacecraft reference frames, the transformation matrices between these reference frames and the environment model. The environment model will consist of the geomagnetic field model, Sun’s position model and the model of the disturbance torques. In chapter 4 the theory of the attitude Master of Science Thesis Morteza Haghayegh 4 Introduction determination and control algorithm will be presented. Simulations of this algorithm will run in the Simulink environment and the results will be presented in chapter 5. Chapter 6 will discuss the software-in-the-loop tests and tests on the processor. Finally, chapter 7 will present the final conclusions and the recommendations. In the conclusion section the research questions will be answered in detail. Morteza Haghayegh Master of Science Thesis Chapter 2 Attitude Determination and Control Subsystem of the DelFFi Satellites This chapter will give a short overview of the history and the current activities of Delfi program. Moreover, the ADCS hardware and control modes of the DelFFi satellites will be discussed. 2-1 Introduction to the DelFFi Mission This section will provide a short introduction into the DelFFi project and mission as well as the Delfi program and the QB50 project. 2-1-1 Delfi Program The Delfi program is a project at the Delft University of Technology. This project is intended to give students hand-on education and training in addition to technology demonstration for the Dutch space industry. The program started with the Delfi-C3 satellite in November 2004 and launched and operated successfully on 28 April 2008 and onwards. Afterwards the Delfi-n3Xt project initiated in November 2007 and launched in November 2013. The mission objective of the Delfi-n3Xt satellite is to demonstrate propulsion, communication systems and ADCS for future mission. This satellite will be used as a heritage for its successor, the DelFFi satellites. To conclude, the main objectives of the Delfi program are education, technology demonstration and nanosatellite bus development. 2-1-2 QB50 Program and the DelFFi Mission The QB50 project is a unique mission consisting of an international network of 50 nanosatellites for multi-point, performing in-situ measurements in the lower thermosphere and Master of Science Thesis Morteza Haghayegh 6 Attitude Determination and Control Subsystem of the DelFFi Satellites re-entry research. The scientific objective of the QB50 project is to study the temporal and spatial variations of a number of key constituents and parameters in the lower atmosphere. Delft University of Technology is providing two identical satellites, Phi and Delta, within the framework of the QB50 mission and the Delfi program. These satellites will demonstrate the possibility of formation flying. The satellite platform designed for Delta and Phi is based on the Delfi-n3Xt triple-unit CubeSat with modifications specifically for the DelFFi mission. The structure of the DelFFi satellites is depicted in figure 2-1. The mission statement of the DelFFi mission is as follows: "The DelFFi mission shall demonstrate autonomous formation flying and provide enhanced scientific return within QB50 from the 2015 onwards, by utilizing two identical triple-unit Cubesats of TU Delft which further advance the Delfi-n3Xt platform" 2-2 Orbit and Satellite Properties of the DelFFi Mission Table 2-1 provides the set of parameters of the orbit and the satellite which will be used in all simulations. The orbit parameters have been obtained from an initial estimation [9] of the orbit in which the satellite will be inserted. The satellite parameters have been obtained from estimations based on the Delfi-n3Xt satellite [10] and scaled to the sizing of the DelFFi satellites. The sensor properties have been obtained from the datasheets of the sensors which have been summarised in the DelFFi Design Overview Report [7]. The satellite shall have an initial altitude of 380 km down to at least 200 km [9]. The science sensors will perform in-situ measurements within this altitude range. Figure 2-1: Structure of the DelFFi Satellites [2] Morteza Haghayegh Master of Science Thesis 2-3 Hardware 7 Table 2-1: Orbit and satellite properties of the DelFFi mission Parameter Value Orbit type Eccentricity Inclination Right ascension of the ascending node Argument of perigee Initial mean anomaly Altitude Circular 0 98.6 -15 0 0 200 to 380 0.017 0 0 0.055 0 0 0 0 0.055 Satellite inertia Satellite dimensions h Center of pressure offset from center of gravity Drag coefficient h Maximum magnetic torquer dipole moment h Residual magnetic dipole moment Magnetometer bias Magnetometer noise standard deviation Sun sensor bias Sun sensor noise standard deviation h 2-3 Unit 0.1 0.34 0.1 iT kg·m2 m 0.005 0.005 0.005 2.2 0.4 0.4 0.4 [-] degree degree degree degree km iT iT m [-] A·m2 0.005 0.005 0.005 500 170 <3 0.4 iT A·m2 nT nT degree degree Hardware This section will provide a short overview of the ADCS hardware on-board of the DelFFi satellites. The hardware on-board are [11] • Two magnetometers (of which one is redundant) • Six Sun sensors • Three magnetorquers • Three reaction wheels 2-3-1 Attitude Sensors This subsection will discuss the two attitude sensors that the DelFFi satellites will be equipped with, namely the magnetometer and the Sun sensors. Master of Science Thesis Morteza Haghayegh 8 Attitude Determination and Control Subsystem of the DelFFi Satellites Magnetometer The magnetometers (MM) that will be used are two Honeywell HMC5883L three-axis fluxgate magnetometer. The characteristics of this type of magnetometer, which is used frequently in mobile phones and game devices, is given in table 2-2 [7]. This magnetometer has been chosen for its low-cost, because it is a Commercial-Off-The-Shelf component. Table 2-2: Key characteristics of the magnetometers [7] Section General Specification Accuracy Parameter Brand/Model Communication type Configuration Measurement range Nominal Range In-orbit (scalar) Measurement resolution Noise type Noise level (open field) Bias level Input Honeywell HMC5883L I2C Triple-axis, orthogonal +/- 100 µ T 20 µ - 47 µ T 65 nT white, Gaussian 170 nT (1σ) 500 nT Sun Sensors The DelFFi satellites will each be equiped with 6 Sun sensors (SS) placed on each side of the structure. A casing made of PEEK material provides a square window. A few milimeters below the window, a quadrant photodiode is place which is read out by ciruitry. This allows for shadows to be cast on each of the four photodiodes based on the angle of the Sun. A simple operational amplifier circuit is used to read the output of the photodiodes as a voltage. The voltage output of each photodiode is summed based on rows and columns, and then the values of both rows or both columns are differenced and divided by the sum of the voltages for all four photodiodes. The value of both difference over sums for the rows and columns is compared to a table to determine the angle of the Sun in the sensor frame. The characteristics of these Sun sensors can be found in tabel 2-3 [7]. Table 2-3: Key characteristics of the Sun sensors [7] Section General Specification Accuracy Parameter Brand/Model Communication type Configuration Field of view (FOV) Power comsumption Mass Maximum read-out frequency Noise type Noise level (open field) Bias Morteza Haghayegh Input TU Delft µSS-1 I2C 1 on each satellite face +/- 60 degree 26 mW idle, 66 mW measuring 10 gram 120 Hz white, Gaussian 0.4 degree (1σ) < 3 degree Master of Science Thesis 2-3 Hardware 2-3-2 9 Attitude Actuators This subsection will discuss the two attitude actuators that the DelFFi satellites will be equipped with, namely the magnetic torquers and the reaction wheel system. Magnetic Torquer The magnetic torquers (MTQ) consist of two torque rods of mu-metal with coils wound around it for the X and Y axis and a open structure coil with a rod for the Z axis. The characteristics of the magnetic torquer system are given in table 2-4 [7]. Table 2-4: Key characteristics of the magnetic torquer (MTQ) system [7] Section General Specification Parameter Brand/Model Communication type Configuration Current driving Range Resolution Power consumption Input TU Delft µ MTQ System Analogue 2 rods and 1 open coild Pulse-width Modulation (PWM) +/- 0.4 A · m2 - / off / + 10-150 mW Reaction Wheels The reaction wheel system (RW) consists of three custom-made reaction wheels. The reaction wheels use brushless direct current motors and a bronze flywheel. A microcontroller located just below the motor on a PCB will drive the motors. The torque commands given by the Attitude Determination and Control algorithm are converted to accelerations of the flywheel by the driver electronics, which are subsequently converted into fast closed-loop control of the current to the motors. The characteristics of the reaction wheel system can be found in table 2-5 [7]. Table 2-5: Key characteristics of the reaction wheel system [8] Section General Specification Parameter Brand/Model Communication type Configuration Angular momentum dynamic range Maximum torque at maximum speed Power consumption Mass Master of Science Thesis Input TU Delft RW+ System I2C Trip-axis +/- 1.44 · 102 Nms 5 · 10-5 Nm 10-150 mW 92 grams Morteza Haghayegh 10 Attitude Determination and Control Subsystem of the DelFFi Satellites 2-4 Mode Switch Logic This section will discuss the mode switch logic as defined by the DelFFi team and the mode switch logic that will be used for this thesis. These two differ due to changes in the requirements as set by QB50 and scheduling changes that need to be taken into account. These changes will be discussed in this section as well. 2-4-1 Mode Switch Logic Defined by the DelFFi Team The following attitude modes have been defined by the DelFFi team (appendix A-2): 1. Detumble Mode: The detumble mode will be used to detumble the satellite from its initial rotation rate to a desired rotation rate. In this mode the magnetometer and the magnetic torquers will be used. 2. Nadir-pointing Mode: The satellite needs to continuously point to the ground for communication with the ground station. This mode is the nominal mode, which means that it will be automatically activated whenever the satellite is detumbled. 3. Sun-pointing Mode: The satellite’s wings located on the +z direction of the body fixed reference frame occasionally need to point to the Sun for maximum power generation. This mode will be initiated by a command from the ground. For a detailed discussion of the body fixed reference frame and the other reference frames, chapter 3 can be consulted. 4. Thrust Vector Control Mode (TVC Mode): This mode will point the satellite’s +x or the -x direction in the velocity vector, such that the thruster can decrease or increase the orbit altitude. This mode will also be initiated by a command from the ground. 5. Safe Mode: This mode is initiated in case the ADCS software detects any abnormal conditions. the detumble mode will be started again. These attitude modes result in a mode switch logic as depicted in figure 2-2. 2-4-2 Mode Switch Logic Defined for this Thesis For this thesis different attitude modes will be defined. This is because some aspects of the DelFFi mission have been changed. These changes are listed below: • The antenna system of the satellite will consist of turnstile antennas, which gives a high overall gain and omni-directionality of the antennas [12]. Therefore a nadir-pointing mode is not necessary. • The QB50 payload will need to point in the velocity vector, as discussed in appendix A1 requirement MIS-C-M.1. Therefore the nominal attitude mode will be a mode where the payload is pointing in the velocity vector. Morteza Haghayegh Master of Science Thesis 2-4 Mode Switch Logic 11 ADCS Start Safe Mode Sun-pointing Mode Detumble Mode TVC mode Nadir-pointing Mode If state is normal If abnormality occures If rotation rate > 1 deg/s If rotation rate < 1 deg/s By command Figure 2-2: Mode switch logic of the attitude modes as defined by the DelFFi team Master of Science Thesis Morteza Haghayegh 12 Attitude Determination and Control Subsystem of the DelFFi Satellites • To be able to point the satellite’s QB50 payload in the velocity vector at all times, the satellite will not have a Sun-pointing mode. Instead, the Sun-pointing mode will be included in the mode which points the QB50 payload in the velocity vector. These items result in four attitude modes, namely: 1. Detumble Mode: After the ADCS is started, the Detumble mode is initiated. This will happen when the satellite has been jettisoned from the launch pod. The rotational rate threshold for successful detumbling has been set to 1 degree/s, as stated by the requirements (table A-5). 2. Velocity-pointing Mode (VP mode): The payload needs to point in the along-track direction, hence the satellite principle axis needs to point in the along-track direction as well. This will be the nominal mode for the attitude determination and control subsystem. This mode will also include a Semi Sun-pointing algorithm. This algorithm will rotate the satellite around its roll axis to face the Sun for maximum power. 3. Thrust Vector Control mode (TVC mode): The thruster is pointing in the negative x axis of the body-fixed reference frame which is in the along-track axis of the satellite, visualized in figure 2-1. Therefore in order to change the orbit the thruster will need to point in the along-track direction. This mode will use the reaction wheel system for higher pointing accuracies. 4. Safe Mode: This mode is initiated in case any abnormal conditions have been detected. All sensors and actuators will be switched off to save power, except for the magnetometer which uses low amount of power. As soon the abnormal condition is solved, the detumble mode will be started again. Due to scheduling constraints the reaction wheel system of the satellite will not be used in the analysis in this thesis. This therefore excludes the TVC mode from the design in this thesis, because the TVC mode uses the reaction wheel system for higher angular pointing accuracy. It should be noted that the TVC mode will be implemented in the ADC algorithm at a later design stage. An overview of the newly defined attitude control modes with their respective requirements has been given in table 2-6. These requirements have been set-up in cooperation with the project manager of the DelFFi mission. Table 2-6: New ADCS requirements for the DelFFi satellite (* = this mode will not be discussed in this thesis) Mode Sensors Actuators Detumble mode VP mode TVC mode * Safe mode MM MM, SS MM, SS MM MTQ MTQ MTQ, RW None Morteza Haghayegh Rotation rate accuracy required <1 deg/s <1 deg/s <1 deg/s n/a Attitude accuracy required n/a <10 deg <2 deg n/a Master of Science Thesis 2-5 Timing Sequence of the ADCS ADCS Start 13 Safe Detumble If state is normal If abnormality occures (By Command) If rotational rate > 1 degree/s Velocitypointing Mode If rotational rate < 1 degree/s By Command Thrust Vector Control Mode * Figure 2-3: Mode Switching Logic for the Attitude Determination and Control algorithms of the DelFFi satellites (* = this mode will not be discussed in this thesis) 2-5 Timing Sequence of the ADCS The attitude determination and control algorithms will only be a part of the ADCS. The ADCS also needs to read sensor measurements and control the actuators. For each step a certain time is allocated. The sequence of these steps is given as follows: 1. Sensor measurement: Here the magnetometer measurements and Sun sensor measurements will be performed. This includes the conversion of the raw Sun sensor data into Sun direction vector and the calculation of the time derivative of the geomagnetic field vector from two consecutive geomagnetic field vector measurements. 2. Algorithm execution: This includes the algorithms that determine the mode and the execution of the control mode algorithms. 3. Actuating magnetic torquer: The magnetic torquer will be turned on in this step. Depending on the duty cycle provided by the algorithm, the magnetic torquers will be turned on for a specific amount of time. The remaining time the magnetic torquers will be turned off. Nevertheless the time for this step is fixed. 4. Hold: This step has been added to account for the magnetic hysteresis of the magnetic torquer. All other activities that are not related to the magnetic torquer can be performed in this step, such as storing housekeeping data. In chapter 5, the time of each step will be carefully evaluated for the detumble mode. These timings will then also be used for the velocity-pointing mode. Master of Science Thesis Morteza Haghayegh 14 2-6 Attitude Determination and Control Subsystem of the DelFFi Satellites Overview of the ADC Algorithms and the Simulation Environment The overview of the ADC algorithms and the simulation environment is given in figure 24. This figure gives the data flow of the ADCS where the algorithms and the simulation environment will interact with each other. As can be seen in the figure, there are two control modes, namely the detumble mode and the velocity-pointing mode. The third mode, namely the safe mode, is not depicted in the picture. The safe mode is characterized by a single variable which will indicate whether the algorithm will continue with one of the control modes after mode determination or it will skip the control modes and wait for next loop. Note that the Thrust Vector Control mode has not been displayed in this overview. Simulation Environment Environment Sensor Modelling Legend Process Algorithm Detumble Control Mode Determination VelocityPointing Control Attitude Determination Decision Figure 2-4: overview of the ADC algorithms and the simulation environment Morteza Haghayegh Master of Science Thesis Chapter 3 Dynamics and Kinematic Models and Enviroment Modelling This chapter will discuss the spacecraft and the environment model. First the reference frames used throughout this thesis and the reference frame transformation matrices will be discussed which are needed for the discussion of the spacecraft dynamics and environment models. 3-1 Common Spacecraft Reference Frames This chapter will describe the reference frames that will be used throughout this report. Earth Centered Inertial Reference Frame This frame is abbreviated to I (or ECI) reference frame. The origin of the I frame lies in the center of the Earth. It is represented by the x axis pointing from the center of the Earth to the Vernal Equinox. The Vernal Equinox is also called the first point of Aries. It is the point where the Sun’s rays are perpendicular to the Earth’s surface at the location on Earth which is closest to the Sun at the start of spring. It can also be defined as the point where the ecliptic plane and the equatorial place cross. The z axis points from the center of Earth to the North along the spin axis of the Earth which goes through the poles of the Earth. The y axis completes the right handed coordinate system. This reference frame has been visualised in figure 3-1. Earth Centered Earth Fixed Reference Frame This frame is abbreviated to E (or ECEF) reference frame. This reference frame has its origin in the center of Earth as well. The x axis points from the center of the Earth to the point where the Greenwhich Meridian and the equatorial place cross. The z axis points along the Master of Science Thesis Morteza Haghayegh 16 Dynamics and Kinematic Models and Enviroment Modelling same axis as the z axis defined in the I reference frame. The y axis completes the right handed coordinate system. This reference frame has been visualised in figure 3-2. Figure 3-1: ECI reference frame [3] Figure 3-2: ECEF reference frame [3] Satellite Orbit Fixed Reference Frame This frame is abbreviated to O reference frame. The origin of this reference frame is the center of mass of the satellite. The y axis is pointing towards the negative orbital plane normal direction. The z axis points towards the nadir direction. The x axis completes the right handed coordinate system. Satellite Body Fixed Reference Frame This frame is abbreviated to B reference frame. The origin of this reference frame is located at the center of mass of the satellite. The x axis is directed along the major axis of the satellite. The positive direction is defined as the direction that is opposite to the ideal thrust force. The z axis is pointing from the center of mass of the satellite along the axis perpendicular to the plane where the solar panels are located on the ’wings’ of the satellite. The positive z direction is the direction that the solar panels are facing. The y axis completes this right handed coordinate system. This has been visualised in figure 2-1. Sun Pointing Reference Frame This frame is abbreviated to S reference frame. The origin of this reference frame is the center of mass of the satellite. The z axis points towards the Sun. The y axis points towards the projection of the y axis of the I frame on the plane perpendicular to the z axis of the S frame. The x axis completes this right handed coordinate system. A visualisation of this reference frame with respect to the Earth-Centered Inertial reference frame is given in figure 3-3. Morteza Haghayegh Master of Science Thesis 3-2 Transformation Between Reference Frames Figure 3-3: Sun pointing reference frame 17 Figure 3-4: Thrust pointing reference frame Thrust Pointing Reference frame This frame is abbreviated to T reference frame. This reference frame has its origin at the center of mass of the satellite. The x axis points towards the velocity vector. The z axis points towards the projection of the z axis of the S frame on the plane perpendicular to the x axis of the T frame. The y axis completes this right handed coordinate system. A visualisation of this reference frame with respect to the Sun pointing reference frame is given in figure 3-4. 3-2 Transformation Between Reference Frames The transformation between reference frames is important for both the simulation environment and using it on the algorithm of the attitude determination and control subsystem. These transformations will specify the attitude of the reference frames with respect to the Earth Centered Inertial reference frame (I frame). In this section the inverse of the transformation matrices can be performed by taking the transpose of the matrices. This can be explained by the fact that the columns of transformation matrices are linearly independent and therefore a transformation matrix is an orthogonal matrix, as stated by the invertible matrix theorem [13]. In linear algebra, an orthogonal matrix is a square matrix with real values and whose rows and columns are orthogonal unit vectors, also called orthonormal vectors. Multiplying an orthogonal matrix with its transpose gives the identity matrix (equation 3-1, where A is an orthogonal transformation matrix and I is the identity matrix). This leads to the result that the transpose of an orthogonal matrix is equivalent to the inverse of the orthogonal matrix. AT A = AAT = I AT = A−1 (3-1) It should be noted that the graphs used to illustrate the transformation of the reference frames in the coming three sections are not showing the vectors to scale. Master of Science Thesis Morteza Haghayegh 18 Dynamics and Kinematic Models and Enviroment Modelling 3-2-1 Transformation ECI frame to ECEF frame As illustrated in figure 3-2 and explained in section 3-1, the z axis, which is the spin axis of the Earth, of the Earth Centered Earth Fixed (E frame) and Earth Centered Inertial (I frame) reference frame are equal to each other. Rotation around the z axis will be sufficient to align the x and y axis of the I frame with the x and y axis of the E frame. This rotation angle is a function of the time. The E and I frame are aligned once every sidereal day, hence the rotation angle is defined by: 2πt ϕ = Ωt t = (3-2) Tsidereal Where t is the time since the last alignment of the E and I frame and Tsidereal of the Earth is equal to 86163.9 seconds. The sidereal time, or the sidereal day length, of the Earth is the time it takes for the Earth to complete one rotation around its axis. Rotating around the z axis with this angle gives: TEI cos (ϕ) sin (ϕ) 0 = − sin (ϕ) cos (ϕ) 0 0 0 1 (3-3) This transformation has been used to rotate the vector that specifies the position of the satellite with respect to the center of the Earth expressed in I frame, rI , to the E frame, rE and to rotate the geomagnetic field vector expressed in the E frame to the I frame, using the transpose. 3-2-2 Transformation ECI frame to T frame In order to describe the Thrust-pointing frame (T frame) in the I frame the velocity vector of the satellite expressed in the I frame, VI , is needed. To align the I frame with the T frame 2 successive rotations will be performed around the x and z axis. The rotation sequence is described as follows: 1. The first rotation around the x axis of the I frame with angle ϕ rotates the y axis of the I frame to the y axis of the intermediate frame, I∗ , to align it with the projection of the negative velocity vector on the yz plane of the I frame (which is also the yz plane of the I∗ frame). This is visualised in figure 3-5. −VI,y ϕ = arccos 2 q , sign (−VI,z ) 2 2 VI,y + VI,z (3-4) 2. The second rotation around the z axis of the I∗ frame rotates the x axis of the I∗ frame to the x axis of the T frame to align it with the positive velocity vector. This is visualised in figure 3-6 . VI,x θ = arccos (3-5) ||VI || Morteza Haghayegh Master of Science Thesis 3-2 Transformation Between Reference Frames 19 Figure 3-5: First rotation for the transformation from ECI reference frame to Thrust-pointing reference frame 3. The transformation matrix of the I frame to the T frame is then defined as: TT I = Tz (θ) Tx (ϕ) (3-6) This transformation matrix, also called the Direction Cosine Matrix will be used to determine the direction in which the satellite needs to points its thrusters for changing the orbit. Semi Sun-pointing during Velocity-Pointing Mode For the DelFFi it has been decided to align the satellite to the velocity-pointing direction during the nominal mode. This means that the satellite will never be able to fully point to the Sun for an optimal Sun angle which results into maximum power from the solar panels mounted on the satellite. However, it is possible to rotate around the velocity-pointing axis in a way that the solar panels are receiving maximum amount of power. This will not change the velocity-pointing behaviour of the satellite. This technique will be called Semi Sun-pointing. The working principle of the Semi Sun-pointing mode is that it changes the desired attitude of the satellite, without changing the velocity-pointing attitude of the satellite. Therefore Semi Sun-pointing will be performed by modifying the desired attitude of the satellite as obtained Master of Science Thesis Morteza Haghayegh 20 Dynamics and Kinematic Models and Enviroment Modelling Figure 3-6: Second rotation for the transformation from ECI reference frame to Thrust-pointing reference frame from equation 3-6. The procedure to change the desired attitude in order to add the Semi Sun-pointing is given as follows: • First, the Sun vector will be expressed in the thrust pointing reference frame: ST = TT I SI (3-7) • Secondly, the rotation angle around the x axis will be calculated such that the z axis of the satellite will point to the Sun vector expressed in the yz plane of the thrust pointing reference frame. S T,3 ψ = arccos 2 q , −sign (ST,2 ) (3-8) 2 2 ST,2 + ST,3 • Finally, the new rotation matrix will be defined with which the newly defined desired attitude quaternion can be determined. TSI = Tx (ψ) TT I Morteza Haghayegh (3-9) Master of Science Thesis 3-2 Transformation Between Reference Frames 21 Nadir-pointing during Velocity-pointing Mode In the same way as described in the previous paragraph by rotating around the roll axis for pointing towards the Sun, the satellite can be pointed towards the Earth, while still keeping the velocity vector and the positive x axis of the satellite aligned with each other. The approach is analogous to the approach described in the previous paragraph. The difference is in the reference vector. Instead of the Sun vector, the Earth vector will be used. the Earth vector is the unit vector that points from the Earth to the satellite. This vector can be obtained from the SGP4 model on-board the satellite in the same way as the velocity vector has been obtained. 3-2-3 Transformation ECI frame to O frame In order to describe the orbital frame (O frame) in the I frame, two vectors are needed, the position of the satellite with respect to the center of the Earth expressed in the I frame, rI and the velocity vector of the satellite expressed in the I frame, VI . To align the I frame with the orbital frame 3 successive rotations will be performed around the z, y and again z axis (323 rotation sequence). The rotation sequence is described as follows: 1. The first rotation around the z axis of the I frame with an angle ϕ rotates the x axis of the I frame to the x axis of the I∗ frame to align it with the projection of the negative position vector, -r vector, of the satellite on the xy plane of the I frame. This rotation is given in the following equation and a visualisation is given in figure 3-7. ϕ = arccos 2 q −rI,x rI,x 2 + rI,y 2 , sign (−rI,y ) (3-10) The newly defined frame is denoted as I∗ frame. The angle ϕ is calculated by using the arccos2 function which is defined in appendix B 2. The second rotation around the y axis of the intermediate frame I∗ with an angle ϑ rotates the z axis of the I∗ frame to the z axis of the I∗∗ frame to align it with the negative position vector, -r vector. This rotation is given in the following equation and a visualisation in figure 3-8. −rI,z θ = arccos (3-11) ||rI || The newly defined frame is denoted as I∗∗ frame. 3. The third rotation around the z axis of the intermediate frame I∗∗ with an angle ψ aligns the x axis of the O frame with the projection of the velocity vector, VI , on the xy plane of the I∗∗ frame, defined as V∗∗ . This rotation angle is given in the following equation and a visualisation is given in figure 3-9. ψ = arccos 2 q Master of Science Thesis V∗∗,x V∗∗,x 2 + V∗∗,y 2 , sign (V∗∗,y ) (3-12) Morteza Haghayegh 22 Dynamics and Kinematic Models and Enviroment Modelling Figure 3-7: First rotation for the transformation from ECI reference frame to Orbit reference frame Where the vector V∗∗ is defined as: V∗∗ = Ty (θ) Tz (ϕ) VI (3-13) 4. The transformation matrix of the I frame to the O frame is then defined as: TOI = Tz (ψ) Ty (θ) Tz (ϕ) (3-14) This transformation matrix, also called the Direction Cosine Matrix, will be used to simulate the aerodynamic and the gravity gradient disturbance torque. 3-3 Rotational Kinematics This section will focus on describing the orientation of the satellite that is in a rotational motion. One reference frame can be expressed with respect to another reference frame in multiple ways, namely Direction Cosine Matrix, euler angles and quaternions. In the second Morteza Haghayegh Master of Science Thesis 3-3 Rotational Kinematics 23 Figure 3-8: Second rotation for the transformation from ECI reference frame to Orbit reference frame part of this section, the attitude of the satellite will be described when it is under the influence of a rotational motion. This is important for propagating the attitude of the satellite in the attitude simulator code programmed in Matlab/Simulink. 3-3-1 Direction Cosine Matrix Using the Direction Cosine Matrix (DCM) that describes the rotation from an arbitrary reference frame M to N, a vector that is described in reference frame M can be converted to a vector expressed in reference frame N. This is described in the following equation: vN = TMN vM vN,1 TM N,11 TM N,12 TM N,13 vM,1 vN,2 = TM N,21 TM N,22 TM N,23 vM,2 vN,3 TM N,31 TM N 32 TM N,33 vM,3 Master of Science Thesis (3-15) Morteza Haghayegh 24 Dynamics and Kinematic Models and Enviroment Modelling Figure 3-9: Third rotation for the transformation from ECI reference frame to Orbit reference frame Three elementary rotations respectively about the first, second and third axes (x, y and z respectively) of the reference frame M are described by the following rotation matrices: 1 0 0 Tx (ϕ) = 0 cos ϕ sin ϕ 0 − sin ϕ cos ϕ cos θ 0 − sin θ 1 0 Ty (θ) = 0 sin θ 0 cos θ (3-17) cos ψ sin ψ 0 Tz (ψ) = − sin ψ cos ψ 0 0 0 1 3-3-2 (3-16) (3-18) Euler Angles The rotation from the arbitrary reference frame N to N can also be expressed in terms of Euler angles. Euler angles are three angles which will rotate the reference frame M to N using three Morteza Haghayegh Master of Science Thesis 3-3 Rotational Kinematics 25 succesive rotations with the aforementioned three angles. If the satellite body axis performs three rotations in a 321 rotation sequence, namely yaw, pitch and roll, then the DCM can be obtained from these three Euler angles in the following way: TM N = Tx (ϕ) Ty (θ) Tz (ψ) (3-19) In general the rotation sequence can start about any axis, followed by one of the other axis and ended with a rotation about one of the axis which is not the same as the second axis rotation. 3-3-3 Quaternion It is possible to rotate any reference frame to another reference through only one rotation about a certain defined axis. This axis will be defined as the Euler eigenaxis. One special property of this eigenaxis which follows from its definition is that it has the same direction in both M and N reference frame. The angle with which one reference frame needs to be rotated about the Euler eigenaxis to obtain the other reference frame is denoted as θ. This rotation can be expressed as a quaternion defined as: " q= h Where e1 e2 e3 the Euler eigenaxis. iT q q4 # = q1 q2 q3 q4 = e1 sin 2θ e2 sin 2θ e3 sin 2θ cos 2θ (3-20) is the Euler eigenaxis and θ is the angle with which is rotated about The quaternion parameters are not independent of each other, but are constrained by the relationship: qT q + q42 = 1 (3-21) Another property of the quaternion is that q and -q describe the same rotation. The prove of these properties will not be treated in this thesis, but can be found in [14] and [15]. The DCM can be described as a quaternion: TM N 1 − 2 q2 2 + q3 2 = 2 (q1 q2 − q3 q4 ) 2 (q1 q3 + q2 q4 ) 2 (q1 q2 + q3 q4 ) 2 (q1 q3 − q2 q4 ) 1 − 2 q1 2 + q3 2 2 (q2 q3 + q1 q4 ) 2 2 2 (q2 q3 − q1 q4 ) 1 − 2 q1 + q2 (3-22) And vice versa: q4 = 1 2 q (1 + TM N,11 + TM N,22 + TM N,33 ) TM N.23 − TM N,32 TM N,31 − TM N,13 TM N,12 − TM N,21 q= Master of Science Thesis 1 4q4 (3-23) Morteza Haghayegh 26 3-3-4 Dynamics and Kinematic Models and Enviroment Modelling Kinematic Equation For a correct simulation of the attitude, the attitude needs to be propagated based on a certain rotational motion acting on the satellite. Let the body fixed reference frame (frame B) be rotating with respect to the Earth-Centered Inertial reference frame (frame I) with an angular velocity of ω BI . Using equation 3-15, a vector in the B frame can be transformed to the I frame: vI = TBI T vB (3-24) Taking the time derivative of this equation gives: 0 = ṪTBI vB + TTBI v̇B (3-25) (3-26) This can be converted to: 0 = ṪTBI − TBI T Ω∗ vB = ṪBI TBI T + Ω∗ Where Ω∗ is the skew-symmetric matrix defined as: 0 −ω3 ω2 0 −ω1 Ω∗ = ω3 −ω2 ω1 0 (3-27) Equation 3-26 can be rewritten in: Ṫ21 T31 + Ṫ22 T32 + Ṫ23 T33 ω = Ṫ31 T11 + Ṫ32 T12 + Ṫ33 T13 Ṫ11 T21 + Ṫ12 T22 + Ṫ13 T23 (3-28) Substituting equation 3-22 and adding the time derivative of equation 3-21 into equation 3-28, gives: ω1 2 (q̇1 q4 + q̇2 q3 − q̇3 q2 − q̇4 q1 ) ω 2 (q̇ q + q̇ q − q̇ q − q̇ q ) 2 2 4 3 1 1 3 4 2 (3-29) = ω3 2 (q̇3 q4 + q̇1 q2 − q̇2 q1 − q̇4 q3 ) 2 (q̇1 q1 + q̇2 q2 − q̇3 q3 − q̇4 q4 ) 0 Rewriting this equation in matrix form gives: " ω 0 # = 2 q4 q3 −q2 −q1 q̇1 q̇ −q3 q4 q1 −q2 2 q2 −q1 q4 −q3 q̇3 q1 q2 q3 q4 q̇4 (3-30) And rewriting this equation again gives the Kinematic Equation: Where Ω is defined as: Ω= Morteza Haghayegh q̇1 q̇2 q̇3 q̇4 1 = Ω 2 q1 q2 q3 q4 (3-31) 0 ω3 −ω2 ω1 −ω3 0 ω1 ω2 ω2 −ω1 0 ω3 −ω1 −ω2 −ω3 0 (3-32) Master of Science Thesis 3-4 Euler’s Dynamic Equation 3-4 27 Euler’s Dynamic Equation This chapter will discuss the rotational dynamics of the satellite. This behaviour of the satellite will be simulated in the attitude simulator to determine the rotational motion of the satellite based on a certain torque applied to the satellite. In addition, the rotational dynamics will also be implemented in the Attitude Determination algorithm to predict the rotational motion of the satellite. The angular momentum of a rigid body can be calculated with [14] H = Jω (3-33) Where H is the angular momentum, J is the moment of inertia of the DelFFi satellite and ω is the angular velocity of the satellite’s body with respect to the Earth-Centered Inertial reference frame. The inertial time derivative of the angular momentum is: Ḣ = T (3-34) Where T is the torque exerted on the satellite about its center of mass. This torque consists of all the external torques, namely the disturbance torques and the control torques. The change in angular momentum can also be written as: Ḣ = ḢI = ḢB + ω × H (3-35) Substituting the equation of the angular momentum of a rigid body and the time derivative of the angular momentum of a rigid body (equation 3-33) into the previous equation gives: Jω̇ + ω × Jω = T (3-36) Rewriting this equation gives Euler’s Dynamic Equation which describes the rotational dynamics of a rigid body: ω̇ = J−1 (T − ω × Jω) (3-37) 3-5 Spacecraft Orbit Dynamics The position and velocity of the satellite will be simulated by varying the time t for a fixed semi-major axis a, eccentricity e, inclination i, right ascension of the ascending node Ω and argument of perigee ω. From these variables, the position and velocity vector will be determined as follows [16] 1. The mean anomaly will be computed: M =n·t Where n is the orbital speed defined as: n = q (3-38) µ a3 2. Assuming that the eccentricity anomaly E is equal to the mean anomaly M, the true anomaly θ can be computed: θ tan 2 s Master of Science Thesis = (1 + e) E tan (1 − e) 2 (3-39) Morteza Haghayegh 28 Dynamics and Kinematic Models and Enviroment Modelling 3. The distance between the Earth’s center and the satellite is computed as follows: r = a(1 − e · cos(E)) (3-40) 4. The position components in the inertial reference frame, which define the distance between the satellite and the center of the Eart, are then defined as: rI,x = r ((cos Ω cos ωap − sin Ω sin ωap cos i) cos θ + (− cos Ω sin ωap − sin Ω cos ωap cos i) sin θ) rI,y = r ((sin Ω cos ωap + cos Ω sin ωap cos i) cos θ + (− sin Ω sin ωap + cos Ω cos ωap cos i) sin θ) rI,z = r (sin ωap sin i cos θ + cos Ωsin i sin θ) (3-41) 3-6 Environment Modelling This section will discuss the environment models. Firstly, the model that determines the geomagnetic field vector will be discussed. Secondly, the model that determines the Sun vector will be discussed. Finally, the disturbance torques acting on the satellite will be discussed. It should be noted that due to the low orbit of the satellite, the solar radiation pressure will be considered to be negligible [7]. 3-6-1 Model of the Geomagnetic Field This section will describe the two models that will be used for simulating the geomagnetic field vector. In the next section the geomagnetic field will be modelled as a dipole. This will give sufficient accuracies for use in the simulations. In the section after that the IGRF model will be introduced. This model will be used on-board the satellite as a look-up table to use in the Extended Kalman Filter. Geomagnetic Field model used for Simulations For modelling the geomagnetic field vector, the magnetic field will be modelled as a dipole which provides a first order approximation. The dipole model of the geomagnetic field is visualised in figure 3-10. According to the dipole moment the geomagnetic field vector is equal to the negative gradient of the scalar potential function V multiplied by the magnetic permeability of free space, µ0 . This relation is given in the following equation: B = −∆V · µ0 (3-42) The potential function of the geomagnetic field vector can be described by: 1 mrE (3-43) 4πr3 Where m is the magnetic dipole moment of the Earth, rE is the position in the ECEF frame expressed in spherical coordinates where the potential function will be calculated given in equation 3-44. r rE = θ (3-44) φ V(r) = Morteza Haghayegh Master of Science Thesis 3-6 Environment Modelling 29 Figure 3-10: Geomagnetic Field represented as a dipole [4] Where θ is the colatitude measured positive from the North Pole and φ is the longitude as measured from the Greenwich meridian. Inserting equation 3-43 into equation 3-42 gives the geomagnetic field vector expressed in the ECEF frame as spherical coordinates. This equation is given as follows: Br 2 cos (θ) µ0 m sin (θ) Bθ = 4πr3 Bφ 0 (3-45) Where the magnetic dipole moment of the Earth is assumed to be the same in all the three axes. As can be seen from equation 3-45, the geomagnetic field in the φ component of the spherical coordinates is zero. This can be explained by the geomagnetic field being independent of the longitude due to the fact that the geomagnetic field has been modelled using a dipole model. In figure 3-10 this independence between the geomagnetic field and the longitude is visualised. Converting the values of the geomagnetic field vector from spherical coordinates to cartesian components gives: Bx (Br cos (δ) − Bθ sin (δ)) cos (φ) − Bφ sin (φ) B = By = (Br cos (δ) − Bθ sin (δ)) sin (φ) − Bφ sin (φ) Bz Br sin (δ) + Bθ cos (δ) (3-46) Where δ is the latitude measured positive from the North Pole. Geomagnetic Field model used on-board DelFFi For the geomagnetic field determination on-board of the satellite the Inertial Geomagnetic Reference Frame (IGRF) data will be used. This model is more accurate than the dipole Master of Science Thesis Morteza Haghayegh 30 Dynamics and Kinematic Models and Enviroment Modelling model, but this is required for the high demands set by the Kalman Filter as discussed in section 4-2. Since the model of the IGRF is computationally intensive, the data from the IGRF is stored on-board of the satellite using a look-up table. The look-up table will contain as inputs the radius, the longitude and the latitude of the position of the satellite. As an output, the IGRF look-up table provides the x, y and z components of the geomagnetic field expressed in the ECEF frame. The position of the satellite will be computed by the SGP4 orbit propagator using Two-Line Element data. 3-6-2 Model of the Sun’s position The Sun model described in this section will provide the direction of the Sun in the ECI frame (I frame) for any give time since the last alignment of the Sun direction and the Vernal Equinox. The Vernal Equinox is defined as the start of Spring (in the Northern Hemisphere). Similarly, the Vernal equinox is located at the point where the eliptic plane and the equatorial plane intersect. The model of the Sun is given in the following equation [17]: SI = 2π(t−tve ) T year ve ) cos (ε) · sin 2π(t−t Tyear ve ) sin (ε) · sin 2π(t−t Tyear cos (3-47) Where t-tve is the time since the last alignment of the Sun direction with the Vernal Equinox given in seconds, Tyear is the amount of seconds in one year equal to 31557600 seconds, and ε is the angle between the ecliptic plane and the equatorial plane, which is approximated to be 23.440 degrees. Modelling the Eclipse Periods For modelling the occurrence of the eclipse periods, the position vector of the satellite, rI , and the Sun direction vector, SI , need to be known in the ECI frame (I frame). Note that in this model the Sun is assumed that the Sun direction is the same for all positions in the orbit due to the fact that the Sun is assumed to be far away and therefore its rays are received parallel. 1. First the maximum angle between rI and SI is determined for which the satellite is in eclipse. This is a constant and is given in the following equation: γE = arcsin REarth REarth + haltitude (3-48) Where REarth is the radius of the Earth and haltitude is the altitude of the satellite. 2. Secondly the real angle between the rI and SI is determined using a dot produc: rI · −SI α = arccos ||rI || Morteza Haghayegh (3-49) Master of Science Thesis 3-6 Environment Modelling 31 Figure 3-11: Eclipse occurrence 3. The requirement for the occurrence of eclipse is then: α < γE (3-50) Which can be explained using figure 3-11 where this problem is geometrically visualised. here it can be clearly seen that when α decreases below a constant value γE , then the satellite is in eclipse. 3-6-3 Model of the Disturbance Torques This section will provide the equations for modelling of the disturbance torques. Aerodynamic Disturbance Torque The aerodynamic drag force is one of the major contributors to the disturbance torque. It is caused by the fact that there is still some air particles present at the altitude in which the DelFFi satellite is operating. The aerodynamic disturbance torque is determined by calculating the aerodynamic drag force in the negative x direction of the O frame, given in equation 3-51. The surface area of the satellite is considered to be maximum at all times, regardless of the orientation of the satellite with respect to the O frame, equal to 0.34 m · 0.1 m = 0.034 m2 . The aerodynamic force in the O frame is therefore considered to be constant. ρ is the air density, CD is the drag coefficient of the satellite, given in table 2-1 and V is the velocity of the satellite, given in equation 3-52, where a is the semi-major axis and Torb is the orbit period. The aerodynamic drag force in the O frame is then projected onto the B frame using the attitude of the satellite with respect to the O frame expressed in the B frame (Tbo ), given in equation 3-53. Which results in the aerodynamic moment acting on the satellite expressed in the B frame, given in equation 3-54. rCP is the distance between the center of pressure and the center of gravity. This distance is the arm of the aerodynamic moment. It is considered to be maximum at all times, regardless of the orientation of the satellite and is given in table 2-1. −1 1 DO = ρSV 2 0 (3-51) 2 0 Master of Science Thesis Morteza Haghayegh 32 Dynamics and Kinematic Models and Enviroment Modelling V = 2πa Torb (3-52) DB = Tbo · DO (3-53) Maero,B = rCP × DB (3-54) The air density, ρ, is determined using the graph which describes the relation between the altitude, solar flux and the air density, given in figure 3-12. From this graph the following values have been obtained to simulate the minimum, average and maximum values of the air density for the lowest and highest altitude, given in table 3-1. Figure 3-12: Graph of the air density versus the altitude for a varying solar flux [5] Table 3-1: Table of the air density for varying solar flux conditions and highest and lowest altitude Altitude [km] Solar flux Air density [kg/m3 ] 380 380 380 200 200 200 minimum average maximum minimum average maximum 8·10−12 9·10−11 1·10−10 0.5·10−9 1·10−9 3·10−9 Magnetic Disturbance Torque The magnetic disturbance torque is caused by the residual magnetic dipole moment originating from the electronics on-board the satellite. This torque can be calculated using the residual magnetic dipole moment and the geomagnetic field vector expressed in the B frame. Morteza Haghayegh Master of Science Thesis 3-6 Environment Modelling 33 This is given in equation 3-55. Where Mres is the magnetic disturbance torque in Nm, mres is the residual magnetic dipole moment in A·m2 , given in table 2-1, and BB is the geomagnetic field vector expressed in the B frame. Mres = mres × BB (3-55) Gravity Gradient Disturbance Torque The gravity gradient disturbance torque is caused by the fact that the gravity of the Earth is not constant when the satellite is further away from the Earth as a result of the inverse square law. This will result in the satellite aligning its axis of minimum moment of inertia, which is the x axis for the DelFFi satellite as defined in section 3-1, along the nadir vector. The gravity gradient disturbance torque is defined as: Tg = 3n2 a3 × Ia3 (3-56) Where a3 is is the 3rd column of the Direction Cosine Matrix of the B frame w.r.t. the O frame given in equation 3-57, n is the orbit angular speed given in equation 3-58 where µ is the gravitational parameter of the Earth and a is the semi-major axis, and I is the moment of inertia of the satellite given in table 2-1. TOB(1,3) a3 = TOB(2,3) TOB(3,3) r n= µ a3 (3-57) (3-58) Thruster-axis Misalignment Disturbance Torque The thruster may be misaligned with respect to the center of gravity. This will cause an additional disturbance torque which needs to be taken into account. The misalignment in the y and z direction will only be considered, an misalignment in the x direction is considered to be negligible compared to the total length of the satellite. In addition, the thruster will also have an angular misalignment. These misalignments are all visualised in figure 3-13. For the simulations the following values of the misalignments will be used [18]: • α = 2 degree • dy = 1 cm • dz = 1 cm • Fthruster = 1.4 mN Master of Science Thesis Morteza Haghayegh 34 Dynamics and Kinematic Models and Enviroment Modelling The angular misalignment will direct the thrust in a direction which causes the highest disturbance torque for an investigation of a worst case. Hence, the thrust is directed such that the project of the thrust in the yz plane will be perpendicular to the line connecting the center of gravity and the position of the thrust outlet located on the yz plane. These misalignments will induce a disturbance torque in all three body-axis about the center of gravity, namely: sin(α) −dz sin(α) Mthruster,x 2 Fthruster − dy 2 Fthruster Mthruster = Mthruster,y = −dz cos (α) Fthruster − L2x sin(α) 2 Fthruster Lx sin(α) Mthruster,z dy cos (α) Fthruster − 2 2 Fthruster ◦) sin(2◦ ) −0.01 sin(2 0.0014 − 0.01 2 2 ◦ 0.0014 sin(2 ) = −0.01 cos (2◦ ) 0.0014 − 0.34 2 2◦ 0.0014 0.34 sin(2 ) ◦ 0.01 cos (2 ) 0.0014 − 2 2 0.0014 Mthruster (3-59) −0.13959 = −2.3837 · 10−4 [N m] −2.3623 (3-60) Where Lx is the length of the satellite defined in figure 3-13 and given in table 2-1. Figure 3-13: Thruster misalignment overview Morteza Haghayegh Master of Science Thesis 3-7 Sensor and Actuator Models 3-7 35 Sensor and Actuator Models This section will discuss the mathematical algorithms that have been used to simulate the behaviour of the sensors due to noise and bias and to simulate the behaviour of the actuators based on a certain input to the driving electronics of the actuators. 3-7-1 Magnetometer Modelling The magnetometers will be modelled by adding a simple noise and bias. The input for this will be the geomagnetic field vector, BB , as determined by the simple dipole model which is explained in subsection 3-6-1. The magnetometer measurements are then modelled as: B m = BB + Bn + Bb (3-61) Where Bb is the bias the magnetometer and is estimated to be 500 nT in all three axis. The noise, Bn , is a Gaussian white noise with a standard deviation of 170 nT. These values are taken from chapter 2. The noise value is independent for each axis. 3-7-2 Sun Sensor Modelling The measurement of the Sun vector will be done by rotating the Sun vector as obtained from the model of the Sun’s position as explained in subsection 3-6-2. The rotation will be about the x, y and z axis of the body fixed reference frame with 3 different angles which are independent from each other. These angles are determined using the bias, Sb , which is determined to be 8 degrees and the noise, Sn , of the Sun sensors which has a standard deviation of 0.4 degrees. These values are taken from chapter 2. The angle used for the rotation is given as follows: anglei = Sb + Sn (3-62) the bias and the noise used here will be divided by three for each angle, because there will be three angles which are used for the rotation. Using this angle and the rotations are x, y and z axis, the measured Sun vector can be calculated as follows: Sm = Tz (angle3 ) ∗ Ty (angle2 ) ∗ Tx (angle1 ) ∗ SB (3-63) Where SB is the Sun vector as obtained from the model of the Sun’s position. 3-7-3 Magnetic Torquer Modelling Magnetic torquers are very attractive for usage on cubesats due to the fact that they only require electrical energy, unlike thrusters, and do not have moving or rotating parts, unlike reaction wheels. The torque that magnetic torquers generate is simply a cross product between the magnetic dipole moment in the x, y and z direction and the geomagnetic field vector in the x, y and z direction. The cross product results in a torque which is only perpendicular Master of Science Thesis Morteza Haghayegh 36 Dynamics and Kinematic Models and Enviroment Modelling to the geomagnetic field vector in that specific position in the orbit. The magnetic torquer torque is give by: Tmtq = mmtq × Bm (3-64) Where mmtq is the magnetic dipole moment in vector form produced by the magnetic torquers and Bm is the measured geomagnetic field vector. The magnetic torquers have a maximum magnetic dipole moment that they can produce which is equal to 0.4 A·m2 . The magnetic torquers designed for the DelFFi mission have three states: on in the negative direction, on in the positive direction and off, therefore an intermediate value of the magnetic dipole momemt can not be produced. In order to still produce a certain torque which requires a certain magnetic dipole moment, the torquers will be run for a certain amount of time. In this way the magnetic torquers can still produce an effective magnetic dipole moment which is equal to the desired magnetic dipole moment. The time the magnetic torquers need to be on to produce a certain effective magnetic dipole moment can be calculated with the following equation: tmtq = min( mmtq , 1) · (tactuator ) mmax (3-65) Where mmtq is the magnetic dipole moment as commanded by the control algorithm, mmax is the maximum dipole moment that the magnetic torquers can produce and tactuator is the time that the magnetic torquer can operate during one loop. It is important that the magnetic torquers are not running during the time the magnetometers are running to avoid biased measurements of the magnetometers. The magnetic hysteresis of the magnetic torquers can influence the measurements of the magnetometers time. Magnetic Hysteresis The magnetic torquer rods will be magnetized when a current flows through the coil. However, due to magnetic hysteresis the rods will remain magnetized when the current through the coil stops running. A visualisation of this phenomena is given in figure 3-14, where H is the magnetization force and B is the magnetic flux density. As can be seen in the figure, when the magnetization force is zero, that is when there is no current running through the coils, the magnetic flux density is not equal to zero, indicating that the magnetic torquer rods are still magnetized. Another type of the hysteresis curve is given in figure 3-15. This hysteresis curve shows that the magnetic flux density is almost zero when there is no current running through the coils. Both cases, with round loop and flat loop, will be discussed in the analysis of the algorithms. Morteza Haghayegh Master of Science Thesis 3-7 Sensor and Actuator Models Figure 3-14: Hysteresis curve of a round loop [6] Master of Science Thesis 37 Figure 3-15: Hysteresis curve of a flat loop [6] Morteza Haghayegh 38 Morteza Haghayegh Dynamics and Kinematic Models and Enviroment Modelling Master of Science Thesis Chapter 4 Design of the Algorithms This chapter will discuss the algorithms which are used to determine the tumble parameter, the attitude and the rotation rate of the satellite. 4-1 Tumble Parameter Determination Algorithm The tumble parameter will be used to determine whether the satellite has been detumbled. If the satellite is detumbled it will proceed to the velocity-pointing mode which is the nominal mode of the satellite’s ADCS. The satellite will be detumbled if the tumble parameter decreases to a threshold, the detumble limit Ldetumbled for a certain amount of time, tdetumbled . This is because the tumble parameter often reaches the detumble limit threshold without actually being detumbled due to a time delay in the system caused by the low pass filter. The low pass filter will reduce the noise in the Bdot measurement which is induced by the noise of the magnetometer. The detumble limit Ldetumbled and tdetumbled are determined in section 5-1. The tumble parameter is defined as follows: Pi+1 = α · |Ḃmeasured | + (1 − α) Pi (4-1) Where P is the tumble parameter, α is the low pass filter constant, Ḃmeasured is the time derivative of the measured geomagnetic field vector. Using this method to determine the tumble parameter and consequently determining whether the satellite has detumbled, is more effective than determining the rotation rate of the satellite using a attitude determination algorithm. The effectiveness of this method is based on the fact that it uses a simple and reliable algorithm to determine whether the satellite is spinning too fast. However, it should be noted that this method does not determine the absolute rotation rate. Instead, the variables Ldetumbled and tdetumbled will be used to determine whether satellite has detumbled. Therefore, these two parameters need to be tuned. Master of Science Thesis Morteza Haghayegh 40 Design of the Algorithms 4-2 Attitude Estimation Algorithm An important part of the ADCS of a spacecraft is the determination of the attitude and the rotational rate. The attitude determination algorithm of the DelFFi mission will use the measurement of the Sun sensors and the magnetometer. These sensors have been chosen by the project management team of the DelFFi mission [7], because of the heritage from the Delfi-n3Xt mission. Using these two sensors, two vectors in the body fixed reference frame can be obtained. In addition there are mathematical models available as discussed in section 3-6-1 and 3-6-2, which will provide two vectors in the Earth-Centered Inertial reference frame. The fundamental goal of an attitude determination algorithm is finding the rotation matrix that describes the rotation from the inertial reference frame to the body fixed reference frame using the measurements and the mathematical model from the sensors, as given in the following equation: vB = TBI vI (4-2) Where the subscript B indicates by the body fixed reference frame, I indicates the EarthCentered Inertial reference frame, v is a vector and T is the rotation matrix. Due to the unit vector constraint, the unit vector obtained from a measurement or mathematical model only provides two parameters to determine the attitude, while the attitude determination problem requires three independent parameters to determine the attitude. Therefore one vector is not enough (underdetermined) and two vectors is too many (overdetermined). Solving this problem would require (a minimum of) two vectors and to discard one (or more) parameter(s). To avoid discarding parameters, a deterministic attitude determination technique called the TRIAD technique [19] can be applied. This technique will assume that one vector pair of the body and inertial reference frame is correct and the other vector pair is less accurate. In this way all parameters will still be used while still adhering to the attitude determination requirement. Combining this technique with a low-pass filter to filter out the noise of the measurements would result in a suitable attitude determination technique. However, this approach has the disadvantage that it is assumed that one sensor is more accurate than the other. This is a direct implication of the attitude determination problem, therefore an attitude estimation technique will be used instead Attitude estimation requires the estimation of the spacecraft’s orientation and filtering noisy measurements as described in the previous paragraph. There are many different types of filters. In this section the most commonly used filters in the spacecraft attitude estimation field will be discussed. These filters are: 1. Kalman Filter (KF) [20]: A Kalman Filter is an unbiased, minimum-variance linear estimator. The algorithm consists of a recursive method which means that the previous estimated state vector is used to calculate a new estimated state vector. This filter is ideal for tracking the position of an object which is a linear dynamic system. 2. Extended Kalman Filter (EKF) [21]: The motion of a satellite is not a linear system. It is a non-linear dynamical system. The Extended Kalman Filter will linearize the system around the estimated state using the Jacobian matrix, given that the estimation error of the state vector is small. This will extend the Kalman Filter for usage in non-linear dynamic systems. Morteza Haghayegh Master of Science Thesis 4-2 Attitude Estimation Algorithm 41 3. Unscented Kalman Filter (UKF) [22]: A non-linear Kalman filter which is an improvement over the EKF is the Unscented Kalman Filter (UKF). The idea of the UKF method is to produce several sampling points around the current state estimate based on its covariance. This makes the filter applicable to highly non-linear systems. 4. Quaternion Estimator (QUEST) [23]: The QUEST is based on Wahba’s problem. Wahba’s problem is the problem of finding the rotation matrix Rbi that minimizes the loss function: N 1X J(Rbi ) = wk ||vkb − Rbi vki ||2 (4-3) 2 k=1 Where J is the loss function, Rbi is the rotation matrix from the inertial reference frame to the body fixed reference frame, wk are non-negative weights, v are the measurement and model vectors. The smaller J is, the better the approximation of the rotation matrix. 5. Particle Filter (PF) [24]: Particle filters are especially useful when the process noise and the measurement noise are not normally distributed processes. This type of filter belongs to the class of genetic algorithms, which is a search heuristic that mimics the process of natural selection. Genetic algorithms have a high computational load [25]. Attitude Estimation Technique Selection An overview of these filters with their main characteristics is given in table 4-1. The filter that will be used in the ADC algorithm must display the following properties: • Non-linear behaviour of the dynamics and measurement model. • Low computational load. The motion of a satellite is a non-linear system therefore the Kalman Filter and the QUEST are inapplicable, because these two filters require a linear dynamics and measurement model. The filter will be designed for a cubesat, therefore it is important for it to have a low computational load. This results in the Particle Filter being inapplicable. Hence, the filters that are suitable for estimating the attitude are the EKF and the UKF. A comparison by LaViola (2003) [26] between these two filters for the estimation of a motion using quaternions showed that the UKF has similar estimation accuracy, while it has a slightly higher computational load than the EKF. This higher computational load is caused by the fact that the UKF performs (2·L+1) integrations while the EKF performs only 1 integration per loop, where L is the length of the state vector. Based on the fact that the EKF has a slightly lower computational load, without a reduction of performance compared to the UKF, the EKF has been selected as the attitude estimation technique. Extended Kalman Filter Algorithm This section will describe the Extended Kalman Filter which has been designed for the velocity-pointing mode. A general overview of the EKF algorithm is given in figure 4-1. Master of Science Thesis Morteza Haghayegh 42 Design of the Algorithms Table 4-1: List of most commonly used filters in the field of spacecraft attitude estimation. Filter KF EKF UKF QUEST PF Linearity of the dynamics and measurement models Linear X Non-linear Computational load Highly non-linear Low X X X X X X X High X X State vector (x) and covariance matrix (P) Time Propagation x and P Sensor Data Measurement Update (Magnetometer) Magnetometer measurement x and P Measurement Update (Sun Sensor) Magnetic field vector from IGRF Control Sun sensor measurement On-Board Computer Clock Legend Data Stored data Process Figure 4-1: Overview of the Extended Kalman Filter The filter will consist of 3 phases, namely the time propagation step and the two measurement update steps for both sensors. The state vector which has been defined for this filter is given as a combination of the quaternion and the rotational rate: x= h q1 q2 q3 q4 ω1 ω2 ω3 iT (4-4) Where qi is the quaternion which describes the rotation from the I frame to the B frame and ωi is the rotation rate of the B frame with respect to the I frame. Time Propagation Step In this step a mathematical model [21] will be used to propagate the state from the previous time to the current time in order to obtain the a priori state estimate x̂k+1/k and the a priori estimation error covariance matrix, Pk+1/k . The mathematical model that uses the kinematic Morteza Haghayegh Master of Science Thesis 4-2 Attitude Estimation Algorithm 43 equation (equation 3-32) for propagating the quaternion of the state vector is given as: ω1 ω = ω2 ω3 " # [ω×] ω Ωk = −ω T 0 (4-5) 1 Φk = e 2 Ωk ∆t q̂ k+1/k = Φk q̂ k/k Where the subscript k indicates the timestep, ∆t is the time it takes to complete one complete loop. The mathematical model that uses Euler’s dynamic equation for propagating the rotational rate of the state vector is given as: ω̇ k/k = J−1 Tc − ω k/k × Jω k/k ω̂ k+1/k = ω k/k + ω̇ k/k ∆t (4-6) Where Tc is the control torque defined as m × Bmeasured , J is the inertia matrix of the satellite. Note that in the equation of Euler’s Dynamic equation, the disturbance torque is left out to reduce the computational intensity of the algorithm. Next step is to propagate the estimation error covariance matrix P. The estimation error covariance matrix describes the uncertainty of the estimation of the state vector. Low values for the estimation error covariance matrix on the diagonal of the matrix indicate small uncertainties. The function that describes the change in the non-linear state vector uses equation 3-32 and 3-37. This function is given as follows: " f (x) = ẋ = q̇ ω̇ # " = 1 2 Ωk qk/k # J−1 T − ω k/k × Jω k/k (4-7) Linearizing this non-linear function about its nominal values gives the Jacobian matrix of this function: ∂ q̇1 · · · ∂ω∂ q̇1 " # ∂q k/k,1 k/k,3 1 ∂f (x) Ωk 12 Ξk . . . 2 .. .. .. F = (4-8) = = 0[3x4] Θk ∂x ∂ ω̇3 ∂ ω̇3 · · · ∂ω ∂q k/k,1 k/k,3 Where Ξk and Θk are defined as: Ξk = Θk = Master of Science Thesis qk/k,4 −qk/k,3 qk/k,2 qk/k,3 qk/k,4 −qk/k,1 −qk/k,2 qk/k,1 qk/k,4 −qk/k,1 −qk/k,2 −qk/k,3 J −J 0 ωk/k,3 yyJxx zz xx ωk/k,3 JzzJ−J 0 yy ωk/k,2 Jxx −Jyy Jzz ωk/k,1 Jxx −Jyy Jzz J −J (4-9) ωk/k,2 yyJxx zz ωk/k,1 JzzJ−Jxx yy 0 Morteza Haghayegh 44 Design of the Algorithms Using the Jacobian matrix, the state transition matrix Ψ can be determined. The estimation error covariance matrix can then be determined from this state transition matrix as follows: Ψk ="expm (F · ∆t) # 0[4x3] σq 2 I4 Q= 0[3x4] σw 2 ∆tI3 Pk+1/k = Ψk Pk/k Ψk T + Q (4-10) Where Q is the process noise matrix, which describes the standard deviation of the process noise for propagating the quaternion (σq ) and the rotational rate (σω ). Measurement Update Step The measurement update step uses the magnetometer measurement and, if available, the Sun sensor measurements sequentially using the same measurement update algorithm. This measurement update algorithm [21] uses the measurement vector in the body fixed reference frame as obtained from the sensors, b, and the reference vector in the inertial reference frame as obtained from the IGRF look-up table or the Sun model, r. The algorithm for the measurement update step is given as follows: s = 21 (b + r) d = 12"(b − r) # − [s×] d H= −dT 0 h H̄ = H 0[4×3] R = σsensor 2 I4 i (4-11) K = Pk+1/k H̄T H̄Pk+1/k H̄T + R −1 x̂k+1/k+1 = I7 − KH̄ x̂k+1/k T Pk+1/k+1 = I7 − KH̄ Pk+1/k I7 − KH̄ + KRKT Where H is the observation matrix, R is the sensor noise matrix, K is the optimal Kalman Gain, x̂k+1/k+1 is the a posteriori state estimate and Pk+1/k+1 is the a posteriori estimation error covariance matrix This algorithm will run once with the magnetometer data and once with the Sun sensor data, if the satellite is not in eclipse. Otherwise the measurement update step will run only once with the magnetometer data. Remarks • The noise covariances Q and R need to be tuned correctly. • It is important to note that the Kalman Gain is only optimal, if the noise is white and the noise covariance estimations are accurate. An optimal Kalman Gain will result in the best blend between predicted and measured state. Morteza Haghayegh Master of Science Thesis 4-3 Control Algorithm 4-3 45 Control Algorithm This section will discuss the equations that will be used for attitude control algorithm of the satellite. The actuator that will be used for actuating the control torques is a set of three magnetic torquers. The interaction between these three current-driven magnetic torquers and the geomagnetic field generates a torque. The torques, however, lie in the plane orthogonal to the geomagnetic field vector. Therefore three-axis attitude control is only possible if the satellite passes a significant part of the orbit where the satellite experiences variations in the geomagnetic field vector. Therefore the satellite is only controllable if the orbit is inclined, to ensure variation of the magnetic field. 4-3-1 Detumble Mode Control During the detumble mode the satellite needs to "follow" a specific field vector. This means that the satellite’s attitude will remain fixed with respect to these field lines. Two difference options are possible for the field vector, namely the geomagnetic field vector and the Sun field vector. The algorithm that aligns the satellite’s body axis with the geomagnetic field vector using magnetometer measurements is called the Bdot control algorithm. Similarly the algorithm that aligns the satellite’s body axis with the Sun field vector using the Sun sensor measurements is called the Sdot control algorithm. The Bdot control algorithm has two advantages over the Sdot control algorithm. Firstly, in the case of the Bdot control algorithm, the commanded magnetic dipole moment can be obtained directly from the calculations. This commanded magnetic dipole moment is used as an input for the actuator driver. In the case of the Sdot control algorithm, the torque first needs to be converted to the commanded magnetic dipole moment. Secondly, the magnetometer measurements are always available, whereas the Sun sensor measurements are not available during eclipse. Therefore the Bdot control algorithm has been chosen as the algorithm in the detumble mode. The next paragraph explains the Bdot control algorithm. Bdot Control The working principle of this technique is to keep the change in the geomagnetic field vector low. This leads to the the satellite having a rotational rate of twice the orbital rate due to the configuration of the geomagnetic field lines. This control algorithm will be simple and computational not intensive, because it does not need attitude determination or estimation algorithms and the control law is simple and efficient. The control itself is only done with magnetic torquers. The Bdot control law is defined as follows: m = −kb · ḂB (4-12) Where m is the magnetic dipole moment expressed in A·m2 , kb is the controller gain expressed in A·m2 ·s·T and Ḃb is the time derivative of the geomagnetic field vector in the body fixed reference frame (B frame) expressed in Tesla. The equation for the calculation of the Bdot is given in the following equation: ḂB = Master of Science Thesis BB,i − BB,i−1 ∆t (4-13) Morteza Haghayegh 46 Design of the Algorithms Where the subscript i denotes the current control step and ∆t is the time between the magnetometer measurements of two consecutive control steps. This magnetic dipole moment will induce a torque on the satellite equal to: T = m × BB (4-14) Where BB is the geomagnetic field vector expressed in the body fixed reference frame in Tesla. The parameter kb is a design parameter that needs to be tuned. 4-3-2 Velocity-pointing Mode Control For the velocity-pointing mode a desired attitude of the satellite will be determined using the velocity vector obtained from the two-line elements (TLEs). This has been explained in section 3-2. The true attitude of the satellite will need to match the desired attitude with a maximum offset of 10 degree, as stated in the ADCS requirements table (table 2-6). Two control techniques that are widely implemented on the ADCS of spacecraft are the Linear Quadratic Regulator (LQR) and the Proportional-Derivative (PD) controller, as shown in a study by Silani et al. (2005) [27]. These two control techniques will be discussd in the next sections. LQR For a general system described in equation 4-15, the LQR control law ([23]) is given in equation 4-16. ẋ(t) = A(t)x(t) + B(t)u(t) (4-15) u(t) = −k · xe (t) (4-16) Where u is the control torque, x is the state vector given in equation 4-4, k is the optimal gain and the subscript e is the error between the desired and true state vector given by the following two equations: q1e q2e q3e q4e = q4d q3d −q2d −q1d −q3d q4d q1d −q2d q2d −q1c q4d −q3d q1d q2d q3d q4d ω e = ω̂ − ω d q̂1 q̂2 q̂3 q̂4 (4-17) (4-18) ˆ is the variable obtained from the attitude estimation algorithm and the subscript d Where () indicates the desired variable. The variable k is chosen to minimize the cost function: 1 L= 2 Z∞ h i xe T Qc xe + uT Rc u dt (4-19) 0 Morteza Haghayegh Master of Science Thesis 4-3 Control Algorithm 47 Where Qc and Rc are covariance matrices. This gives an optimal gain k equal to: k(t) = R−1 B(t)T P(t) (4-20) And P(t) can be found by solving the Ricatti equation given as: PA + AT P − PBR−1 BT P + Q = 0 (4-21) The control torque needs to be converted to a magnetic dipole moment of the magnetic torquer. As discussed in Camillo et al. (1980) [28], an accurate method to perform this conversion is by using the following equation: m= u×B ||B||2 (4-22) PD Control The PD control law is also based on the system given in equation 4-15. The control law is given as follows ([29]): u(t) = Kd Jω e + Kp Jqe (4-23) Where u is the control torque, Kd and Kp are scalar control gains, J is the inertia matrix, ω e is the error between the desired and the estimated rotation rate vectors (given in equation 4-18) and qe is the first three components of the quaternion (the vector part) that describes the error between the desired and the estimated attitude quaternion (given in equation 4-17). The gains will be determined using tuning techniques. Similarly to the LQR method, the magnetic dipole moment will be calculated from the control torque using equation 4-22. Attitude Control Technique Selection The drawback of the LQR method is that solving the Riccati equation is a computationally intensive process that requires numerical integration. However, it is a robust control method, because it gives an optimal gain for varying moments of inertia ([27]). On the other hand, the PD control method is not computationally intensive, because it uses a constant control gain. This results, however, in a non optimal gain where robustness needs to be investigated. Since the PD control uses less computational power and it has been used successfully on a satellite, it has been selected as the attitude control method for the DelFFi satellite. An example of a satellite on which a PD controller has been successfully implemented is the Chinese ZDPS-1A pico-satellite [30]. Moreover, simulations results of the ADCS of the Taiwanese ROCSAT-3 micro-satellite [31] and the Delfi-n3Xt nano-satellite [32] show that this controller can be used to point the satellite in a specific direction. Still, the robustness of the PD controller is a risk and therefore this will be further investigated in chapter 5. As mentioned before, the gains in the PD control need to be tuned. The next section will explain this tuning process. PD Control Gain Selection There are various methods to select the gain of the PD control law given in the previous paragraph. This section will explain two gain tuning techniques. Master of Science Thesis Morteza Haghayegh 48 Design of the Algorithms Ziegler-Nicols Tuning Method The Ziegler-Nicols Tuning method [33] is a heurestic tuning method. It is performed by setting the derivative gain to zero. The proportional gain is then increased until it reaches a state where the control torque is oscillating with a constant amplitude. The gain at which this state has been reached is called the ultimate gain, Ku . If Ku is known then proportional gain Kp and derivative gain Kd can be determined as follows: Kp = −0.8 · Ku K T Kd = − p8 u (4-24) Where Tu is the oscillation period of the control gain for the state where there is a purely oscillating control torque. Quaternion Feedback Regulator Tuning Method The control gains, namely the proportional gain k and the derivative gain d, can be calculated for optimal performance of the control law as a function of the relative error eallowed that is allowed after the settling time Ts has been reached according to Wie et al. (1989) [34], given in the following two equations: Kd = −2 Kp = 4 ln (eallowed ) Ts ln (eallowed ) Ts (4-25) 2 (4-26) The relative error and the settling time need to be tuned for correct performance of the algorithm. Remarks • Increasing the proportional gain will result in a faster convergence, but more overshoot. • Increasing the derivative gain will result in a decrease in overshoot, but slower convergence • Increasing the gains will result in a better performance, however the limitations of the torquer has to be taken into account. The torquer may not be able to deliver the required control torque for too high gains. 4-4 Summary This chapter has presented the algorithms of the ADCS of the DelFFi satellite. These are: tumble parameter determination, attitude estimation and attitude control. The tumble parameter will be determined in order to measure the rotation rate of the satellite with respect to the geomagnetic field. This is an efficient technique to determine the behaviour of the satellite. If this value is lower than a certain threshold Ldetumble for a specific amount of time tdetumble , then the satellite has been detumbled and the velocity-pointing mode will be triggered. Otherwise the detumble mode will be triggered. In case the the flag for the safe mode has been enabled by the OBC, the satellite will enter the safe mode. During the detumble Morteza Haghayegh Master of Science Thesis 4-4 Summary 49 mode the Bdot control law will be used to detumble the satellite. The velocity-pointing mode will consist of an EKF for estimating the attitude and rotation rate and a PD controller for controlling the attitude. The EKF will propagate the state vector and use the measurements of the magnetometer and the Sun sensors to determine the best estimate of the attitude and the rotation rate. These values will then be fed into the PD controller to determine the magnetic dipole moment of the magnetic torquer in order to point the satellite in a desired direction. The Ziegler-Nicols and the QFR tuning technique will be used to tune the two gains of the PD controller. Figure 4-2 gives an overview of the control logic. Start Sensor Measurement Calculate Tumble Parameter Calculate Bdot Mode Determination Safe Mode Next Control Step Safe Mode True False Detumble Mode Calculate required magnetic dipole moment of MTQ for detumble mode Safe_mode == 1 False Ptumble < Ldetumble for tdetumble seconds True Velocity-pointing Mode Kalman Filter Calculate required control torque Calculate desired attitude Calculate required magnetic dipole moment of MTQ for velocitypointing mode = This path is only executed if the block it refers to is executed Figure 4-2: Overview of the Attitude Determination and Control Algorithm Master of Science Thesis Morteza Haghayegh 50 Design of the Algorithms Morteza Haghayegh Master of Science Thesis Chapter 5 Simulation Results In this chapter the results of the simulations of the two control modes will be discussed, namely the detumble mode and the velocity-pointing mode (VP mode). For each mode a sensitivity analysis will be performed. Before showing the results, first the modes will be explained. 5-1 Detumble Mode The control algorithm that will be executed during the detumble mode is the Bdot control algorithm which has been discussed in section 4-3-1. The Bdot controller is designed to lower the time derivative of the geomagnetic field vector to zero or near-zero. This mode will be successfully completed when the tumble parameter, Ptumble , is below a certain value called Ldetumbled for a certain amount of time equal to tdetumbled seconds. 5-1-1 Performance Analysis In this subsection the performance of the Detumble mode will be investigated using varying cases. The investigation of the performance of the Detumble mode will be split up into two parts. The first part will focus on finding the optimal timing sequence interval for a specific initial angular velocity of the satellite’s body axis. The second part will focus on investigating non-nominal conditions. These non-nominal conditions are: high noise in the magnetometer measurement, high aerodynamic disturbance torques and failure of a component of the magnetic torquer resulting in loss of torque around one or two axis. Timing Sequence The timing sequence of the ADCS has been provided in section 2-5. This section will focus on varying the timing of the four parts of the timing sequence, namely sensor measurement, Master of Science Thesis Morteza Haghayegh 52 Simulation Results algorithm execution, actuating magnetic torquer, and the hold period. Table 5-1 provides a list of the cases that will be used where case A is the timing sequence used on the Delfi-n3Xt satellite [32]. Table 5-1: Overview of the cases for determining the optimal timing sequence interval Case Sensor A B C D E F G H 0.1 s 0.1 s 0.1 s 0.1 s 0.1 s 0.1 s 0.1 s 0.05 s Algorithm ∼ ∼ ∼ ∼ ∼ ∼ ∼ ∼ 0 0 0 0 0 0 0 0 Actuator Hold Total time 1.4 s 1s 0.5 s 0.2 s 0.1 s 0.1 s 0.05 s 0.05 s 0.5 s 0.4 s 0.3 s 0.3 s 0.3 s 0.2 s 0.05 s ∼0s 2s 1.5 s 0.9 s 0.6 s 0.5 s 0.4 s 0.2 s 0.1 s s s s s s s s s The table header consists of the following parameters from left to right: • Identifier for the used case • The time it takes to perform one sensor measurement • The time it takes for the algorithm to be executed • The time it takes for the actuator to finish actuating • The time it takes to remove the magnetic hysteresis • Total time it takes to complete one loop The satellite is considered to be detumbled if the satellite is rotating with an angular velocity of less than 1 degree per second around all three axes with respect to the inertial reference frame, as defined by the requirements (table A-5). For each case the initial angular velocity will be increased with 5 deg/s per simulation to find the highest initial angular velocity for which the satellite can still be detumbled. For all cases the same magnetometer noise standard deviation and bias will be used. The orbit and satellite parameters used for the simulations are given in table 2-1. The altitude and the solar flux can be found in table 5-2. This results in an air density of 9·10−11 kg/m3 , as obtained from figure 3-12. The detumble mode parameters can be found in table 5-3. These parameters have been found by first using as an initial estimate of the values from the Bdot control used on the Delfi-n3Xt mission [32] and fine tuning it from h iT those initial estimates. The initial quaternion is 0.378 -0.378 0.756 0.378 . This is an arbitrary attitude of the satellite that still holds the criteria mentioned in equation 3-21. Analysis Table 5-4 gives the results of the simulations. The second column gives the initial angular velocity of the body fixed reference frame with respect to the inertial reference frame for which the satellite can still be detumbled. The third column gives the number of orbits that is required in order to detumble the satellite. The ratio actuator time over total time Morteza Haghayegh Master of Science Thesis 5-1 Detumble Mode 53 Table 5-2: Parameters used in the simulations for finding the optimal timing sequence interval Parameter Value Unit Solar flux Altitude average 380 km Table 5-3: Parameters used for the detumble mode Parameter Value unit kB 28000 1/1200 10−6 A·m2 ·s/T T/s αtumble Ptumble,0 ( tactuator ttotal ) is a key factor in the convergence rate of the detumbling. This ratio will influence the effective maximum magnetic dipole moment of the magnetic torquer. The theoretical maximum magnetic dipole moment of the magnetic torquer is set to be 0.4 A·m2 . The effective maximum magnetic dipole moment is calculated in equation 5-1. mmax,ef f = mmax,theoretical · tactuator ttotal (5-1) From case A until case E this keeps on decreasing which means that the rate of detumbling becomes slower, resulting in a higher number of orbits needed for detumbling. Only in case F it can be seen that this ratio increases resulting in the satellite being detumbled faster. Whether the satellite will be detumbled or remain tumbling depends on the total time it takes to complete one loop, because this determines how fast measurements are taken and how fast the magnetic torquers can change their duty cycles. As can be seen in table 5-1, the satellite can be detumbled for high initial angular velocities of up to 190 deg/s if the magnetometer measurement frequency increases. The physical explanation for this behaviour of the satellite is the fact that the geomagnetic field vector expressed in the body reference frame changes. By reducing the total loop time, the responsiveness of the ADCS to these changes increases. To show this, the timing sequence Table 5-4: Results of the simulations of the detumble mode for varying timing sequence intervals. Master of Science Thesis Case ω0 nr. of orbits A B C D E F G H 10 deg/s 15 deg/s 25 deg/s 35 deg/s 45 deg/s 55 deg/s 110 deg/s 190 deg/s 1 1.25 1.75 3 6.75 6.25 11.5 31 Morteza Haghayegh 54 Simulation Results of case E will be used in the simulation with an initial angular velocity of 10 and 60 deg/s in all three axes. The plots for the geomagnetic field vector expressed in the body reference frame are given in figure 5-1 and 5-2. As has been determined in table 5-1, the satellite will not detumble for an initial angular velocity of 60 degree per second in case E, because the initial angular velocity is too high for the fast changing geomagnetic field vector. However, it can detumble for an initial angular velocity of 10 degree per second, because the geomagnetic field vector changes slowly. The plots for the angular velocity of both cases are given in figure 5-3 and 5-4. −5 B B [T] 6 x 10 geomagnetic field vector in body fixed reference frame 4 BBx 2 BBy 0 BBz −2 −4 −6 0 0.5 1 1.5 2 2.5 t [s] 3 3.5 4 4.5 Figure 5-1: Geomagnetic field vector expressed in the B frame for ω0 = 10 deg/s (Case E) −5 BB [T] 6 x 10 geomagnetic field vector in body fixed reference frame 4 BBx 2 BBy 0 BBz −2 −4 −6 0.5 1 1.5 2 2.5 t [s] 3 3.5 4 4.5 Figure 5-2: Geomagnetic field vector expressed in the B frame for ω0 = 60 deg/s (Case E) 10 ωy 0 ωz −10 −20 Angular velocity of the B frame w.r.t. I frame (Plant) 400 ωx ωplant [deg/s] ωplant [deg/s] Angular velocity of the B frame w.r.t. I frame (Plant) 20 ωx ωz 0 −200 0 2000 4000 6000 t [s] 8000 10000 12000 Figure 5-3: Angular velocity of the satellite with respect to I frame for ω0 = 10 deg/s (timing sequence = case E) ωy 200 0 1 2 3 t [s] 4 5 6 4 x 10 Figure 5-4: Angular velocity of the satellite with respect to I frame for ω0 = 60 deg/s (timing sequence = case E) In the QB50 System Requirements issue 6 published in July 2014 [35] the initial rotation rate for which the satellite needed to detumble from was 10 deg/s within 2 days. Case E meets this requirement and in addition also takes into account a margin for an even higher initial Morteza Haghayegh Master of Science Thesis 5-1 Detumble Mode 55 rotation rate which was yet unknown. For the next analysis and the coming chapters the timing sequence of case E will be used in the simulations. In the QB50 System Requirements issue 7 published in February 2015 [36] the initial rotation rate for which the satellite needed to detumble from increased to 50 deg/s within 3 days. In addition, an extra requirement has been set to recover from an initial rotation rate of up to 90 deg/s in case of non-nominal conditions during the jettisoning from the pod. As can be seen in table 5-1, it is possible to meet these new requirements. For this it is, however necessary to determine the hold time to make sure that the magnetic torquers do not affect the magnetometers as the hold time would need to be lowered to decrease the total time to complete one attitude determination and control loop. Non-nominal conditions For the simulation of the non-nominal conditions, the timing sequence interval of case E will be used, as discussed in the previous paragraph. In addition, the highest initial angular velocity of this case will be used for which the satellite can still detumble, equal to 45 degree per second around all three axis. These non-nominal cases can be found in table 5-5. The different cases are variations of the following parameters: altitude, solar flux, offset of the center of pressure from the center of gravity, noise of the magnetometer measurements and magnetic torquer failure status. These parameters and other parameters used for this simulation are given in table 2-1 and the parameters specific for the detumble mode are given in table 5-3. The cases I to L will be analysed using the mean angular velocity and its standard deviation using a Monte Carlo simulation. Moreover, the detumble limit Ldetumbled and detumble time tdetumbled have been determined for each case. These two parameters have been explained in section 4-1. The cases M1 to M6 will be analyzed using a single simulation run to determine how the detumble mode performs in case of a failure of the magnetic torquer components causing a malfunction in generating a magnetic dipole moment around one or two axis. It should be noted that for the Monte Carlo simulations the same psuedo random variable sets will be used for each case and for the single simulation run the same random variable will be used for each case. Table 5-5: Overview of the cases for the performance investigation of the Detumble mode. The values used in this table are obtained from the orbit and satellite properties table (table 2-1) ω0 Case I J K L M1 M2 M3 M4 M5 M6 [45 [45 [45 [45 [45 [45 [45 [45 [45 [45 45 45 45 45 45 45 45 45 45 45 45] 45] 45] 45] 45] 45] 45] 45] 45] 45] Master of Science Thesis Altitude Solar flux rcp Noise σ MTQ status 380 200 380 200 380 380 380 380 380 380 average maximum average maximum average average average average average average 5 mm 10 mm 5 mm 10 mm 5 mm 5 mm 5 mm 5 mm 5 mm 5 mm 170 nT 170 nT 1700 nT 1700 nT 170 nT 170 nT 170 nT 170 nT 170 nT 170 nT on on on on MTQx off MTQy off MTQz off MTQy & MTQz off MTQx & MTQy off MTQx & MTQz off km km km km km km km km km km Morteza Haghayegh 56 Simulation Results Case I Case I is the standard case as simulated already in case E. The altitude, solar flux, distance between center of pressure and center of gravity and the MTQ failure status are set to their standard values. Case J In case J the components that influence the aerodyanmic disturbance torque have been changed to simulate the worst case disturbance torques. The parameters that are changed are the altitude and the solar flux, which will increase the air density resulting in higher aerodynamic disturbance torques and the distance between the center of pressure and center of gravity rcp by a factor of 2 which increases the arm of the aerodynamic disturbance force. Case K In case K the noise standard deviation has been increased to 10 times the normal value. Case L Case L is a combination of case J and K where both the aerodynamic disturbance torques and the noise have been increased. Case M In case M the magnetic torque performance will be investigated in case of failure of one or more components in the three axis. For this case a Monte Carlo simulation will not be performed. Analysis The results of the simulations are given in table 5-6 and in figure 5-7 to 5-12. The following conclusions can be drawn from these results: 1. In a lower altitude the velocity of the satellite and the air density are higher, resulting in a higher aerodynamic drag. However, the geomagnetic field strength also increases in a lower altitude. The results show that decreasing the altitude does not have a significant effect on the detumbling performance. 2. Increasing the standard deviation of the noise reduces the detumbling performance. The mean angular velocity and the standard deviation of the angular velocity are further away from zero in case K and L compared to case I and J where the noise standard deviation is normal. 3. The detumble limit Ldetumbled and tdetumbled depend on the noise of the magnetometer. Therefore these two variables need to be tuned while the satellite is in orbit. For a higher noise standard deviation, the detumble limit Ldetumbled will be higher and tdetumbled will increase. It should be noted, however, that at the start of the simulation the tumble parameter is below the detumble limit Ldetumbled . This is because the method to obtain the tumble parameter Ptumble requires the tumble parameter to start at zero and increase to the actual value. Because of this, tdetumbled needs to be higher than zero. 4. In case of failure of the magnetic torquer, the satellite will not detumble if it can not produce a torque around the x axis or if it can not produce a torque around both the y and z axes. A failure in the torque around the y or z axis is not a problem, because of the Morteza Haghayegh Master of Science Thesis 5-1 Detumble Mode 57 coupling of the rotational rates. This can be explained with equation 5-2. Expanding this equation gives equation 5-3. Since Izz and Iyy are equal to each other, this equation can be rewritten to equation 5-4. This equation shows that there is a coupling between the rotation rates around the y and z axes. From equation 5-4 it can be concluded that a failure of the magnetic torquer around the x axis will cause Tc,x to be zero resulting in ωx not converging and a failure of the magnetic torquer around the y and z axes will remove the control variable in the second and third row of equation 5-4 which results in the coupling of the parts to be ineffective. ω̇ = J−1 (Tc + Td + ω × Jω) J (5-2) −J Tc,x + Td,x + zzJxx yy ωy ωz ω̇x Jxx −Jzz ω̇y = Tc,y + Td,y + Jyy ωx ωz J −J yy xx ω̇z Tc,z + Td,z + Jzz ωx ωy (5-3) Tc,x + Td,x ω̇x T + T + Jxx −Jzz ω ω x z d,y ω̇y = c,y Jyy Jyy −Jxx ω̇z Tc,z + Td,z + Jzz ωx ωy (5-4) Table 5-6: Results of the performance of the detumble mode for non-nominal conditions of the last 15 minutes for total simulation time of 8 orbits using Monte Carlo simulations. All values given in deg/s unless otherwise stated. Case ωmean,x ωmean,y ωmean,z ωσ,x ωσ,y ωσ,z I J K L -0.0013 -0.0049 0.0583 0.0119 -0.0441 0.0432 -0.2435 -0.0036 0.0473 -0.0056 0.4211 0.0052 0.1159 0.0358 0.3158 0.2377 0.0414 0.0448 0.7925 0.2355 0.1066 0.0631 0.5637 0.1886 Ldetumbled 8·10−7 8·10−7 8·10−6 8·10−6 tdetumbled T/s T/s T/s T/s 100 s 100 s 8000 s 8000 s Angular velocity of the B frame w.r.t. I frame (Plant) ω −5 x 4 ωy 3 ωz 6 5 1 4 0 Ptumble plant [deg/s] 2 ω Tumble parameter x 10 −1 3 −2 2 −3 −4 −5 1 0 0.5 1 1.5 2 2.5 t [s] 3 3.5 4 4.5 4 x 10 0 0 0.5 1 1.5 2 2.5 t [s] Figure 5-5: Angular velocity of the satellite with respect to I frame (Case L) Master of Science Thesis 3 3.5 4 4.5 4 x 10 Figure 5-6: Tumble parameter Ptumble (Case L) Morteza Haghayegh 58 Simulation Results Angular velocity of the B frame w.r.t. I frame (Plant) Angular velocity of the B frame w.r.t. I frame (Plant) 300 80 ωx ωx ωy 250 ωy 60 ωz 200 40 150 20 ωplant [deg/s] ωplant [deg/s] ωz 100 0 50 −20 0 −40 −50 −60 −100 0 2 4 6 8 10 12 14 16 t [s] −80 18 0 2 4 6 8 10 12 14 16 t [s] 4 x 10 Figure 5-7: Angular velocity of the satellite with respect to I frame (Case M1) 4 Figure 5-8: Angular velocity of the satellite with respect to I frame (Case M2) Angular velocity of the B frame w.r.t. I frame (Plant) Angular velocity of the B frame w.r.t. I frame (Plant) 80 80 ωx ωx ωy 60 ωy 60 ωz 40 40 20 20 ωplant [deg/s] ωplant [deg/s] ωz 0 −20 −40 −40 −60 −60 0 2 4 6 8 10 t [s] 12 14 16 18 4 x 10 Figure 5-9: Angular velocity of the satellite with respect to I frame (Case M3) 5-2 0 −20 −80 18 x 10 −80 0 2 4 6 8 10 t [s] 12 14 16 18 4 x 10 Figure 5-10: Angular velocity of the satellite with respect to I frame (Case M4) Velocity-pointing Mode The velocity-pointing mode has been designed to point in the velocity vector during nominal mode of the satellite operation. The FIPEX instrument on-board of the satellite will need to perform in-situ measurements for which the FIPEX instrument needs to point in the velocity vector. The velocity-pointing mode will be initiated when the detumble mode has achieved successful detumbling as defined in section 5-1. Therefore it can be assumed that when the velocity-pointing mode is initiated, the rotational rate of the satellite is low. The ADC algorithm of the satellite will remain in this mode until the rotational rate of the satellite increases and reaches a value above the threshold defined in the requirements in section 24. In the next sections first the attitude estimation and control parameters will be tuned. After that, the velocity-pointing mode will be investigated for four non-nominal and practical conditions. The orbit and satellite parameters that have been used in this section can be found in table 2-1 and 5-2. The timing interval is case E of table 5-1 and the Bdot algorithm parameters are found in table 5-3. The initial rotational rate is equal to 5 degree per second Morteza Haghayegh Master of Science Thesis 5-2 Velocity-pointing Mode 59 Angular velocity of the B frame w.r.t. I frame (Plant) Angular velocity of the B frame w.r.t. I frame (Plant) 300 300 ωx ωx ωy 250 ωy 250 ωz 200 200 150 150 ωplant [deg/s] ωplant [deg/s] ωz 100 100 50 50 0 0 −50 −50 −100 −100 0 2 4 6 8 10 12 t [s] 14 16 18 0 2 4 6 8 10 12 14 t [s] 4 x 10 Figure 5-11: Angular velocity of the satellite with respect to I frame (Case M5) 16 18 4 x 10 Figure 5-12: Angular velocity of the satellite with respect to I frame (Case M6) h iT in all three axis and the initial quaternion is 0.378 -0.378 0.756 0.378 . High values for the initial rotational rate will not be discussed, because it is assumed that the satellite is detumbled during the detumble mode before entering the velocity-pointing mode. The initial quaternion is an arbitrary attitude of the satellite that still holds the criteria mentioned in equation 3-21. 5-2-1 Tuning Parameters This section will discuss the performance of the attitude estimation algorithm for different process noise and sensor noise. After that the performance of the control algorithm will be discussed using the two control gain tuning methods. In order to decouple the attitude estimation parameter tuning from the control gain parameter tuning, the Bdot control algorithm will be used to control the satellite for the cases A to H, where the attitude estimation algorithm parameters are tuned. The attitude estimation parameters are given in table 5-7. The control gain parameters are given in table 5-8. For tuning the attitude estimation parameters, as an initial estimate the parameters from the Delfi-n3Xt mission have been used [32], which is given in table 5-9. The standard deviation of the process noises σq and σω is chosen much higher than the initial estimate. This is because the estimation performance decreases for low values as will be discussed in the next section. For the control gain parameter tuning, two different methods will be used to determine the control gain parameters, namely the Ziegler-Nicols tuning method and the quaternion feedback regulator tuning method. The gains used for the first method are fixed by the ultimate gain Ku and oscillating period Tu , as found in case I. However, the gain used for the second method is determined by setting the relative allowed error eallowed and the settling time Ts . For case J these two parameters have been chosen such that the proportional gain Kp and the derivative gain Kd are similar to the values found in the first method. From this initial estimate, the relative allowed error and the settling time are varied to find the control gain parameters for which the angular pointing error converges to zero as much as possible during the Sunlit phases. Master of Science Thesis Morteza Haghayegh 60 Simulation Results Table 5-7: Attitude estimation parameter tuning cases Case σM M [deg] σSS [deg] σq [-] σω [deg/s] A B C D E F G H 1 20 40 20 20 20 20 20 1 1 1 0.1 1 10 1 1 0.25 0.25 0.25 0.25 0.25 0.25 0.025 2.5 0.25 0.25 0.25 0.25 0.25 0.25 0.025 2.5 Table 5-8: Control gain parameters tuning cases Case erel Ts [s] Ku Tu [s] Kp Kd I J K L M N 0.01 0.03 0.05 0.07 0.09 200 400 600 800 1000 0.003 - 70 - -0.00240 -0.00210 -0.00031 -0.00010 -0.00004 -0.00002 -0.0210 -0.0461 -0.0175 -0.0100 -0.0066 -0.0048 Analysis cases A to H The results will be presented as the angular estimation error given in figures 5-13 to 5-20. For these simulations Monte Carlo simulations will be performed. The angular estimation error is defined as the smallest angle between the Euler eigenaxis of the true attitude expressed in the B frame with respect to the I frame and the estimated attitude expressed in the B frame with respect to the I frame. The Euler eigenaxis is explained in subsection 3-3-3 and the algorithm to obtain the angular estimation error is given in appendix B-2. As can be seen in the figures, it is important to choose the standard deviation of the process noise and the sensor noise accurately to increase the performance of the Extended Kalman Filter. The difference in the performance of the filter between cases A to H is negligible during the period where the Sun is detected. This is because, as explained in section 4-2, there are two vectors available, therefore the filter will be accurate. However, the performance decreases in all cases during the eclipse periods, because there is only one vector available. Therefore there is no Table 5-9: Filter parameters used on the Delfi-n3Xt mission Morteza Haghayegh Parameter Value σM M [deg] σSS [deg] σq [-] σω [deg/s] 3.82 3 0.005 0.00003 Master of Science Thesis 5-2 Velocity-pointing Mode 61 Figure 5-13: Angular Estimation Error in [deg] of case A Figure 5-14: Angular Estimation Error in [deg] of case B Figure 5-15: Angular Estimation Error in [deg] of case C Figure 5-16: Angular Estimation Error in [deg] of case D large difference between cases D to F, where all parameters are kept constant except for σSS . Changing σSS will not have a large influence on the results. Cases A to C When changing σM M it can be noticed that there is a certain optimal value for the best angular estimation error. This has been proven to be σM M = 20 deg. This is the value that resembles the standard deviation of the noise of the magnetometer best. Cases D to F As explained before, the standard deviation of the Sun sensor noise will not have a large impact on the results, because the filter is accurate during the phases where the Sun is detected. Even though the changes in the attitude estimation error are small, a σSS equal to 1 deg gives the lowest angular estimation error during eclipse. Cases G to H The standard deviation of the quaternion process noise and rotational rate process noise are not changed independently, to simplify the tuning method. However it is expected that when the moment of inertia of the satellite differs from the moment of Master of Science Thesis Morteza Haghayegh 62 Simulation Results Figure 5-17: Angular Estimation Error in [deg] of case E Figure 5-18: Angular Estimation Error in [deg] of case F Figure 5-19: Angular Estimation Error in [deg] of case G Figure 5-20: Angular Estimation Error in [deg] of case H inertia inserted in the filter, σω will be higher due to the fact that the rotational rate can be predicted less accurately. Both case G and H have a higher angular estimation error during eclipse compared to case E. Best case The cases with the lowest angular estimation are D to F. Since there is not a significant difference between these cases, case E has been arbitrarily chosen from these three cases. This case will be used in coming simulations. Analysis cases I to N The results of the Monte Carlo simulation are given in figure 5-21 to 5-26. To be able to compare these plots with each other, the mean value of the angular pointing error δpointing and the mean value of the standard deviation of the angular pointing error during the last complete orbit and the last eclipse period has been given in a table 5-10. Case L shows the Ziegler-Nicols tuning method and cases J to N show the quaternion feedback regulator Morteza Haghayegh Master of Science Thesis 5-2 Velocity-pointing Mode 63 Figure 5-21: Angular Pointing Error of case I Figure 5-22: Angular Pointing Error of case J Figure 5-23: Angular Pointing Error of case K Figure 5-24: Angular Pointing Error of case L tuning method where the relative allowed error after settling time has been reached erel has been increased by 0.02 and the settling time Ts has been increased by 200 seconds after each performed case. For the Ziegler-Nicols tuning method the ultimate gain Ku is determined to be 0.003 N·m and the oscillation period of the output of the controller is 70 seconds. Cases I As can be seen in figure 5-21 and table 5-10, the Ziegler-Nicols tuning method does not converge the angular pointing error to values near zero. Cases J to N These cases have been tuned using the quaternion feedback regulator tuning method. In these cases the allowed relative error erel and the settling time Ts have been increased to find the gains which result in a simulation with the lowest angular pointing d error. By increasing eallowed and Ts , the ratio K Kp increases as well, which results in more damping. However, too much damping will have a negative effect on the angular pointing error. Master of Science Thesis Morteza Haghayegh 64 Simulation Results Figure 5-25: Angular Pointing Error of case M Figure 5-26: Angular Pointing Error of case N Table 5-10: Mean values of the Monte Carlo simulations for cases I to N Case I J K L M N Mean δpointing [deg] Last orbit 45.1 39.0 19.3 12.7 14.3 23.1 Last eclipse 52.1 52.2 45.4 43.8 44.8 43.5 Mean of the standard deviation of δpointing [deg] Last orbit 25.1 28.3 18.0 14.3 15.1 20.8 Last eclipse 31.2 35.4 31.2 31.5 30.7 26.9 Kd Best case It can be concluded the ratio K is not optimal for the case of the Ziegler-Nicols p tuning method. The Quaternion Feedback Regulator tuning method does have a optimal d ratio of K Kp , namely case L. 5-2-2 Performance Analysis In this subsection the performance of the velocity-pointing mode will be investigated using different cases. The simulation parameters are identical to the parameters used in the previous section for determining the filter parameters and control gains. In addition, the filter parameters and control gains of case E and L will be used. All cases will be simulated without the mode determination algorithm except for case S. This means that for all cases except for case S only the velocity-pointing mode will be used. Moreover, the control will be turned off during eclipse due to the higher angular estimation error. The cases that will be investigated are: Case P This case will investigate the performance of the velocity-pointing control and attitude determination algorithm where: Morteza Haghayegh Master of Science Thesis 5-2 Velocity-pointing Mode 65 • The magnetic torquer does not have any limitations and can produce a high magnetic dipole moment. • Attitude and rotational rate information is taken directly from the environment model instead of using the extended Kalman filter. This will result in using the true values of the attitude and the rotational rate instead of the estimated values. • No noise in magnetometer. Even though the magnetometer measurement data is not used for the extended Kalman filter in this case, it is used for the calculation of the magnetic dipole moment of the magnetic torquer for a given control torque. • No disturbance torques. • The time to perform one control loop, ttotal , will decrease from 0.5 s to 0.2 s. This resembles a case with ideal conditions. Case Q The IGRF look-up table will be programmed in the service layer of the ADCS software and will be determined using TLEs and propagated using the SGP4 model as explained in subsections 3-5 and 3-6-1. For the purpose of these simulations the IGRF look-up table has been simulated using the real position information obtained from the simulator. In order to simulate the inaccuracy of the IGRF look-up table, the values obtained from the geomagnetic dipole model will be biased in this case. The accuracy of the IGRF look-up table is determined by the resolution of the latitude and the longitude. The bias has been set to be 0.7·10−5 T in all three axis in case Q1. This translates to a jump in the longitude of about 1 degree on average. This is the same IGRF table accuracy as used on the Delfi-n3Xt satellite [10]. It should be noted, however, that this bias is the worst case bias. In reality the IGRF look-up table is discretized, so at the points where the table provides a magnetic field strength the bias will be zero and it will increase when the position of the satellite is such that it is in between two datapoints. In addition, a bias of 1.4·10−5 T in all three axis will also be analyzed (case Q2), which is two times higher than the bias in the Q1 case. Case R The moment of inertia of the satellite will be measured on the ground, however it can change in orbit due to for example propellant sloshing or failure in deployment of one or both of the solar panel wings. The performance of the satellite will be checked for the case where the moment of inertia of the satellite and the moment of inertia as inserted in the attitude estimation algorithm are different. The difference between these two matrices needs to be small for correct functioning of the time propagation step of the extended Kalman filter as given in equation 4-6 in section 4-2. The moment of inertia which is inserted in the extended Kalman filter will be biased with the following moment of inertia error matrix: 0.0010 0.0014 0.0015 h i U = 0.0014 0.0010 0.0013 kg · m2 0.0015 0.0013 0.0020 (5-5) The perturbed moment of inertia U has been obtained by multiplying the expected moment of inertia of the DelFFi satellite given in table 2-1 by a perturbation factor between 0.02 and Master of Science Thesis Morteza Haghayegh 66 Simulation Results 0.03. This perturbation factor is the same as used for the analysis of the European Student Earth Orbiter (ESEO) satellite [37]. The moment of inertia which is inserted in the filter is: JEKF = Jmeasured + U (5-6) Case S The thruster will be fired for a 5 minute period before eclipse in each orbit. A maximum of 5 minute is a suggestion by the thermal control subsystem engineer such that the satellite’s temperature can be kept within bounds [38]. For these simulations the mode determination algorithm will be turned on such that the ADC algorithm can autonomously determine its control mode. It should be noted that during nominal conditions, the velocity-pointing mode will not be used for formation flying and hence the thruster will not be used. However, in case the reaction wheels malfunction, this case will show whether the velocity-pointing mode can be used as a back-up solution for performing formation flying. Analysis cases P to S Figures 5-27 and 5-28 give the angular estimation error and the angular pointing error of the satellite in nominal conditions. The parameters used for the nominal condition are mentioned in the first paragraph of section 5-2. These plots will be used to compare the cases P to S with a simulation with nominal conditions. Figure 5-27: Angular Estimation Error of a case with nominal conditions Figure 5-28: Angular Pointing Error of a case with nominal conditions Case P As can be seen in figure 5-29 and table 5-11, the angular pointing error decreases significantly when the magnetic torquer, magnetometer and attitude estimation algorithm are ideal, when there are no disturbance torques acting on the spacecraft and the time to complete one control loop decreases. When the magnetic torquer does not have any limitations and there are no disturbance torques, the available torque is higher and the required torque is lower so the spacecraft will be able to change the attitude much faster. Increasing the performance of the magnetometer will result in a more accurate determination of the magnetic dipole moment Morteza Haghayegh Master of Science Thesis 5-2 Velocity-pointing Mode 67 of the magnetic torquer which is required in the velocity-pointing control, as can be found in equation 4-22. Using the attitude and rotational rate from the environment model instead of the EKF, results in more accurate attitude estimation which leads to more accurate pointing. Decreasing the time to complete one loop, tsensor results in a higher update frequency of the magnetic dipole moment which is being fed into the environment model causing the attitude to be controlled at a higher frequency. It should be noted that there is, just like in all other cases, no control during eclipse, therefore the angular pointing error increases during this period. When the satellite is back in the Sunlit phase of the orbit, it will start the velocitypointing control again. However, since the attitude and the rotational rate of the satellite are not the same after each eclipse, the time to reduce the angular pointing error differs. Figure 5-29: Angular Pointing Error of case P Case Q The angular estimation error of cases Q1 and Q2 are given in figures 5-30 and 5-32 respectively. The angular pointing error of cases Q1 and Q2 are given in figures 5-31 and 5-33 respectively. Comparing these plots with the simulation run with nominal conditions it can be seen that the angular estimation error increases drastically with peaks at 12 degree for case Q1 and 30 degrees for case Q2. Hence a decrease in the accuracy of the IGRF look-up table lowers the performance of the estimation algorithm. The satellite is able to point to the desired attitude with an accuracy of 3.1 degree for case Q1 and 9.4 degree for case Q2 during the last 10 minutes of the last orbit of the simulation, as can be found in table 5-11. Case R As can be seen in figure 5-34, where the angular estimation error of case R is given, it can be concluded that an inaccurate determination of the satellite’s moment of inertia increases the angular estimation error during eclipse. This effect is not observed during the Sunlit periods. This can be explained by the fact that the eclipse periods rely heavily on the time propagation stage where the satellite’s moment of inertia is used in the determination of the angular acceleration of the satellite. The Sunlit periods also use the time propagation stage, however unlike the eclipse periods, the Sunlit periods use the Sun direction vector, in addition to the geomagnetic field vector, which results in an attitude estimation using two vectors. The use of two vectors greatly improves the estimation. The control is turned off during eclipse. Therefore this increase in angular estimation error does not have an effect on the angular pointing error. Master of Science Thesis Morteza Haghayegh 68 Simulation Results Figure 5-30: Angular Estimation Error of case Q1 Figure 5-31: Angular Pointing Error of case Q1 Figure 5-32: Angular Estimation Error of case Q2 Figure 5-33: Angular Pointing Error of case Q2 Case S Figures 5-36 and 5-37 show the angular velocity and the angular pointing error of cases S. It should be noted that the gaps in the angular pointing error plots are caused by the fact that the detumble mode is turned on during those periods. The detumble mode does not use a desired attitude for control, therefore there is no angular pointing error. The angular pointing error average in the last 10 minutes before the last thrusting period for a simulation of 5 orbits is given in table 5-11. As discussed before, the thruster has been fired for a 5 minute period just before the eclipse when the satellite has been detumbled in each orbit. As can be seen in figure 5-36 the satellite will start to tumble right after starting the simulation. After a brief period of running the velocity-pointing mode, the mode determination algorithm will set the control mode to the detumble mode. While the satellite is in the detumble mode, the thruster will not be turned on. When the satellite is detumbled and the thruster is turned on, the plot shows that the satellite immediately starts rotating. This increases the tumble parameter Ptumble and hence the detumble mode will be triggered again by the mode determination algorithm. As can be seen from figure 5-37, the satellite is pointing in the velocity vector with a pointing error of 10 degree or less when the thruster is turned Morteza Haghayegh Master of Science Thesis 5-2 Velocity-pointing Mode 69 Figure 5-34: Angular Estimation Error of case R Figure 5-35: Angular Pointing Error of case R on. This shows that the moment in time when the thruster is turned on (just before eclipse) is sufficient for the velocity-pointing mode to point the satellite in the velocity vector after recovering from the previous thruster firing. Another advantage of thrusting before eclipse is that the eclipse period can be used to reduce the high rotational rates during the detumble mode. Since it is not possible to control during eclipse in the velocity-pointing mode, the detumble mode is ideal to run during eclipse. Figure 5-38 shows the angular pointing error zoomed in on the last thrusting period for a simulation of 5 orbits. Here it can be seen that due to the firing of the thruster, the angular pointing error increases to 52 degree. This angular pointing error of 52 degree is higher than the required 2 degree pointing error given in table 2-6. Thrusting with an angular pointing error of more than 2 degree produces an unreliable thrusting force in the along-track direction. This shows that reaction wheels are essential in keeping the desired attitude. Therefore it can be concluded that firing the thruster for formation flying with only magnetic torquers will not contribute to an accurate orbit manoeuvre. For the purpose of these simulations tdetumbled has been set to zero such that the mode determination algorithm has a shorter response time when the satellite needs to enter velocity-pointing mode. Table 5-11: Mean value of the angular pointing error of the last 10 minutes before the last eclipse (or in case S, before the last thrusting period) for a simulation of 5 orbits Master of Science Thesis Case δpointing [deg] Nominal P Q1 Q2 R S 2.1 0.1 3.1 9.4 3.3 8.0 Morteza Haghayegh 70 Simulation Results Figure 5-36: Angular velocity of case S Figure 5-37: Angular Pointing Error of case S Morteza Haghayegh Master of Science Thesis 5-3 Requirement Verification and Recommendations 71 Figure 5-38: Angular Pointing Error of case S. Zoomed in on the last thrusting period 5-3 Requirement Verification and Recommendations This chapter has presented the simulation results of the detumble mode and the velocitypointing mode. This section will verify the requirements and provide recommendations. Detumble Mode The detumble mode can achieve a rotation rate of less than 1 deg/s in all axes in nominal conditions for an initial rotation rate of up to 45 deg/s in all axes within 6.75 orbits which is equal to 0.4 days. This meets the requirements presented in [35], which dictates that the cubesat shall be able to recover from tip-off rates up to 10 deg/s within 2 days. The 35 deg/s higher initial angular velocity is a result of an uncertainty in the requirements at the start of the design process. In addition, for a different actuator operation time and hold time, it also meets the new requirements set by QB50 for which the satellite needs to recover from tip-off rates of up to 50 deg/s within 3 days for nominal conditions and 90 deg/s in non-nominal conditions. Velocity-pointing Mode In this chapter the velocity-pointing mode has been simulated with an initial rotation rate of 5 deg/s and an arbitrary attitude. It has been shown that the satellite can point in the velocity vector with an angular pointing error of less than 10 deg in nominal conditions during at least half of the Sunlit phases (figure 5-28). It is decided to not control the magnetic torquers during eclipse periods, because the angular estimation error increases rapidly during the eclipse periods. Due to the fact that the satellite is not pointing in the desired attitude after eclipse it will take some time to point in this attitude again. The time it takes until the satellite is pointing in the desired attitude differs. The angular pointing error will be below 10 degree during at least the second half of the Sunlit phase. It can be concluded that Master of Science Thesis Morteza Haghayegh 72 Simulation Results the velocity-pointing mode only meets the requirement (requirement MIS-C-M.1 of appendix A-1) of pointing the payload in the velocity vector during the second half of the Sunlit phase. Recommendations It is clear that the fact that the requirement can not be met is due to the sensor limitation during eclipse periods. A possible way to solve this issue is by adding a sensor that does not have the same limitation as the Sun sensors. This will result in a higher angular estimation accuracy during eclipse periods. A suggestion would be to include a gyroscope or Earth horizon sensors in the design. The reference vector measured by one of these sensors would replace the Sun direction vector measured by the Sun sensors. With a continuously high angular estimation accuracy, the control algorithm would stay on continuously. This will result in a high angular pointing accuracy for both Sunlit periods and the eclipse periods, thus meeting requirement MIS-C-M.1 (appendix A-1). It can be concluded that the requirement of pointing in the velocity vector at all times will not be met during eclipse periods and the first half of the Sunlit phase with the current choice of sensors. If the requirement is adjusted to only point in the velocity vector in the second half of the Sunlit phase, then the mission can continue. In this case the scientific payload will be able to perform measurements for the duration of half of the Sunlit phase. This corresponds to about 35% of the orbit. The next chapter will verify the ADC algorithm based on the fact that the mission will continue even with the limited pointing performance. Morteza Haghayegh Master of Science Thesis Chapter 6 Testing of the ADC Algorithm This chapter will be focussed on testing the ADC algorithm using a software-in-the-loop (SIL) simulation and testing a part of the algorithm on the processor. In addition, before starting with the testing phase, some typical issues in coding will be discussed which has been taken into account in the algorithm. The SIL simulation will be performed to find errors in the algorithm due to the code generation process. The focus of the test on the processor will be to demonstrate whether the algorithm on the processor produces the same outputs as the algorithm in Simulink. For generating code which is suitable for the flight hardware of the DelFFi mission, it has been chosen to generate C code from the algorithm designed in Matlab/Simulink using the Simulink Embedded CoderTM . This method of code generation has become increasingly widely used in generation of code for software which needs to run on critical components, especially in the aerospace industry [39]. The advantage of generating code from a pre-designed algorithm is the re-usability of the code. It is more convenient for a programmer to adjust a code in Simulink and run the simulation to see the implications of the adjustment rather than adjusting a C code. 6-1 Software Issues The designed algorithm has been specifically designed with the idea that it should work as a black box. It should require a certain input coming from the sensors and generate a certain output which is intended for the actuator with as little interference in the code during execution as possible. The performance of the algorithm may, however deviate from this ideal case. Two issues which can cause this are discussed in this section. Shared-data problem When a mode switch occurs during the execution of a control mode, the performance of the algorithm should not be altered compared to a situation where a mode switch did not occur. Master of Science Thesis Morteza Haghayegh 74 Testing of the ADC Algorithm This means that the entire algorithm, from the point where a mode has been determined until the end of the algorithm where an output is generated for the input of the actuator, should be atomic in order to prevent the problem of shared-data. A process is called atomic when the process can not be interrupted. In order to avoid this problem, the control modes and the safe mode will not be initiated by an interrupt. Instead the control mode mode will be determined in the mode determination algorithm. This algorithm will check whether the flag for the safe mode has been enabled to activate the safe mode or activate one of the control modes. Which control mode is activated is based on the mode determination algorithm, as explained in chapter 4. If the flag of the safe mode is enabled during the execution of one of the control modes, the execution will first need to finish before the flag is checked again during the next loop. Task overrun Task overruns occur when a processor requires extra processing and as a result requires more time to execute than normally. Hence, a new task might be executed before the previous task has been completed. The problem of task overruns will be solved by using flags in the code. The task overrun flag is enabled at the start of the execution of the code. When this task finishes, the flag is disabled. Before setting the flag, the status of the flag will be checked. If the flag is enabled, meaning that the task is not finished yet, then the algorithm will continue to run until the task has been finished. To prevent the algorithm from deadlocking during the execution of a task, the amount of times the next loop of the algorithm is skipped will be measured. If this value exceeds a certain threshold, then the task overrun will be reset such that the code can start with a new task. 6-2 Algorithm Testing This section will discuss the software-in-the-loop testing and testing the algorithm on the processor 6-2-1 Software-in-the-loop Testing Software-in-the-loop testing, also called SIL testing, is a method to test the C code of the algorithm directly inside the simulation program. Testing directly on hardware is usually quite expensive and hardware is mostly available later on in the project phase. Software-in-the-loop tests therefore provide an agile and low-cost solution to testing code. The purpose of the SIL test is to test the code in an inexpensive way to check for bugs associated with C code. These are the type of bugs that do not occur in the Matlab/Simulink language. The C code of the algorithm is generated using the standard S-function package in Simulink. S-functions provide a fast way to generate C code for SIL testing. This C code is embedded in the S-function Simulink block and can be integrated in the model to replace a part of the code that is written in Simulink. For the software-in-the-loop tests, the following cases will be discussed: Morteza Haghayegh Master of Science Thesis 6-2 Algorithm Testing 75 Case A In this case the algorithm in Simulink will be simulated. This case will be used to compare the results of the other cases with results obtained from a simulation of the Simulink code. A visualisation of case A can be found in figure 6-1. Case B In this case the algorithm converted in separate C code files will be simulated using a software-in-the-loop test. These separate blocks of C code are: • Mode determination algorithm • Safe mode algorithm • Detumble mode algorithm • Velocity-pointing mode control algorithm • Extended Kalman filter algorithm. The storage of the state vector and covariance matrix output that is used as an input in the next loop in the filter is coded in Simulink instead of C code. This storage of the output of the filter is done using a memory block which can be found in the package for discrete Simulink blocks in the Simulink toolbox library. This case will run twice. The first run will be with the C code in the closed loop (case B1). The second run will be with the Simulink code in closed loop and the C code in an open loop (case B2) such that both the results of the Simulink code and the C code can be compared with each other. A visualisation of case B1 and B2 can be found in figures 6-2 and 6-3. Simulink code Space Environment & Spacecraft Dynamics Models in Simulink Memory block for data storage Simulink code Simulation Environment C code VP Mode Control Mode determination, detumble mode, VP mode (including EKF) Figure 6-1: Visualisation of the SIL test set-up for case A Master of Science Thesis EKF Mode Determination Detumble Mode Figure 6-2: Visualisation of the SIL test set-up for case B1 Morteza Haghayegh 76 Testing of the ADC Algorithm Simulink code Space Environment & Spacecraft Dynamics Models in Simulink Mode determination, detumble mode, VP mode (including EKF) Output + m Case A Memory block for data storage Δm - m Case B1 C code VP Mode Control EKF Mode Determination Detumble Mode Figure 6-3: Visualisation of the SIL test set-up for case B2 Case C This case is similar to case B1 with the only difference being the fact that the C code for the Extended Kalman Filter also stores the value of the output to be used as an input to the filter in the next loop. This means that the memory block is coded in C instead of using the memory block of the Simulink toolbox library. A visualisation of case C can be found in figure 6-4. Case D In this case the algorithm is converted in a single C code file and will be simulated using a software-in-the-loop test. A visualisation of case D can be found in figure 6-5. The parameters for the satellite and orbit properties that have been used in this chapter can be found in table 2-1 and 5-2. The timing interval of the sequence of events of the ADCS is case E of table 5-1 and the Bdot algorithm parameters are found in table 5-3. In addition Ldetumbled and tdetumbled of the mode determination algorithm are set to be 8·10−7 T/s and 100 s respectively, as discussed in chapter 5-1. The initial rotational rate is equal to 5 degree per second in all three axes. In addition the filter parameters and control gains of case E and Morteza Haghayegh Master of Science Thesis 6-2 Algorithm Testing 77 Simulink code Simulink code Space Environment & Spacecraft Dynamics Models in Simulink Space Environment & Spacecraft Dynamics Models in Simulink C code Memory block for data storage VP Mode Control EKF C code Mode Determination Mode determination, Detumble mode, VP mode(including EKF) Detumble Mode Figure 6-4: Visualisation of the SIL test set-up for case C Figure 6-5: Visualisation of the SIL test set-up for case D L are used, as discussed in chapter 5-2. Analysis SIL Test Case A The rotational rate of the spacecraft is given in figure 6-6 and the mode determination variable is given in figure 6-7, which shows which mode is executed. A mode determination variable equal to 0 indicates that the detumble mode is executed and 1 indicates that the velocity-pointing mode is executed. Figure 6-8 and 6-9, show the angular estimation error and the angular pointing error, respectively. This case will be used to compare it with the other cases. Mode determination (0=Detumble, 1=VP) 1 0.9 0.8 0.7 C mode 0.6 0.5 0.4 0.3 0.2 0.1 0 0 Figure 6-6: Rotational rate in case A Master of Science Thesis 0.5 1 1.5 2 t [s] 2.5 3 3.5 4 x 10 Figure 6-7: Mode determination variable in case A Morteza Haghayegh 78 Testing of the ADC Algorithm Figure 6-8: Angular Estimation Error in case A Figure 6-9: Angular Pointing Error in case A Case B1 The rotational rate, the mode determination variable, angular estimation error and angular pointing error are given in figures 6-10, 6-11, 6-12 and 6-13, respectively. Comparing these to their counter parts in the previous case (case A), it can be concluded that the simulation of this case gives similar results as the simulation of case A during the detumble mode. The behaviour of the algorithm will, however, differ in the velocity-pointing mode, but the inaccuracies are small enough for the algorithm to still control the spacecraft within the bounds of the requirements. The cause of these inaccuracies will be visible in the results obtained in case B2. Case B2 The purpose of this case is to find the accuracy of the commanded magnetic dipole moment that is generated by the C code of case B1. This C code will be executed in an open loop with the Simulink code of case A as has been depicted in figure 6-3. The accuracy of the commanded dipole moment is given by: ∆m = mcase_A − mcase_B1 (6-1) Where mcase_A and mcase_B1 are the commanded dipole moment of the simulations of case A and case B1 in open loop, respectively. The plot of this accuracy of the commanded magnetic dipole moment is given in figure 6-14. In this figure the magnetic dipole moment of each axis can not be distinguished separately, however this figure shows that the accuracy of the simulation of the C code of case B1 is high during the detumble mode. This accuracy decreases when the amount of arithmetic operations increases, hence the inaccuracy of the velocity-pointing mode is evident. This is especially the case at the start of the velocitypointing mode where the angular estimation error is high, as can be seen in figure 6-8. The peak just after the second eclipse in figure 6-14 reaches an order of 10−9 A·m2 . This explains why the simulation results of the velocity-pointing mode of case B1 differ with respect to the simulation results of case A. The inaccuracy is however not high enough to introduce high pointing errors as has been shown in case B1. Case C The results of the simulation of this case are similar to the results of the simulation of case B1 during the detumble mode. The mode determination algorithm sets the control Morteza Haghayegh Master of Science Thesis 6-2 Algorithm Testing 79 Mode determination (0=Detumble, 1=VP) 1 0.9 0.8 0.7 C mode 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.5 1 1.5 2 t [s] 2.5 3 3.5 4 x 10 Figure 6-10: Rotational rate in case B1 Figure 6-11: Mode determination variable in case B1 Figure 6-12: Angular Estimation Error in case B1 Figure 6-13: Angular Pointing Error in case B1 mode to the velocity-pointing mode after the satellite has been detumbled. However, the EKF can not estimate the attitude correctly during the velocity-pointing mode. It can be seen from table 6-1 that the EKF of case C gives identical results as the EKF of case A in the first loop. This result will be stored and used in the second loop. However, the input to the EKF is incorrect during the second loop in case C, which results in an error in the quaternion. This is caused by an incorrect storage of data on the processor. Master of Science Thesis Morteza Haghayegh 80 Testing of the ADC Algorithm Figure 6-14: Accuracy of the commanded magnetic dipole moment (case B2) Table 6-1: Results of the quaternion obtained from the EKF in case A and in case C q1 Output EKF first loop secoond loop Case A 0.0413 0.0920 q2 Case C 0.0413 0.4753 Case A 0.0289 0.0617 q3 Case C 0.0289 0.3425 Case A 0.0152 0.0233 q4 Case C 0.0152 0.1672 Case A 0.9986 0.9936 Case C 0.9986 0.7930 Case D The rotational rate and the mode determination variable of case D can be found in figures 6-15 and 6-16, respectively. In this SIL simulation the velocity-pointing mode will never be initiated as can be seen in figure 6-16. This is caused by the fact that the counter in the mode determination algorithm, which counts the time since the tumble parameter Ptumble is lower than Ldetumbled , is reset after each loop which results in the counter never exceeding the required detumble time tdetumble . The variables Ldetumbled and tdetumbled have been explained in section 4-1. In the simulation in case A this counter is only reset when the Simulink block which contains the counter is executed again after not being executed in the previous loop, because this indicates that the detumble mode has been initiated again. Due to the fact that the C code is enclosed in one file instead of multiple files, the processor will not be able to detect whether the code that contains the counter has been executed already. This causes the counter to reset after each loop, hence the ADC algorithm remains in the detumble mode. Best case Case A is a simulation of the algorithm in Simulink and has been used to compare it to the different cases and will therefore not be considered in the selection. Case B1, C and D have presented three different configurations for the C code of the ADC algorithm. Case B2 has been used to determine the error between the commanded magnetic dipole moment Morteza Haghayegh Master of Science Thesis 6-2 Algorithm Testing Figure 6-15: Rotational rate in case D 81 Figure 6-16: Mode determination variable in case D between case A and B1 and will therefore not be used in the selection of the best case. Case C and D both showed errors in the code that are caused by the C code generation process. Case B1 showed results similar to case A. Therefore it has been chosen to use the C code of case B1 in the implementation of the algorithm on the processor. 6-2-2 Testing the ADC Algorithm on the Processor The algorithm that will be used on the processor has been generated using the Simulink Embedded CoderTM . For the generation of the algorithm code a 32-bit Embedded Processor has been chosen as the target hardware. This means that the target hardware is optimized for arithmetic operations involving variables with 32 bits. Since the Simulink simulations use doubles with 64-bit precision, this means that the target hardware will run slower than a 64-bit Embedded processor, however the precision of the variables will be the same as the Simulink simulations. It should be noted that the time to execute the algorithm will not be measured. This is considered to be changing depending on the hardware, therefore it is suggested that the time to execute the algorithm should be measured on the flight hardware. Hardware The processor that will be used to test the algorithm should meet the requirements as stated in requirements analysis of the DelFFi mission. Based on these requirements, a trade-off has been performed to determine a suitable processor for the testing of the ADCS algorithm by J. Viru [40]. The hardware that will be used to test the algorithm is the TivaTM C series TM4C1294 Connected LaunchPad Evaluation BoardTM . It uses a TM4C1294NCPDT microcontroller-unit which is a 32-bit, 120 MHz ARM Cortex-M4 CPU with floating point. The development board TM4C1294 Connected LaunchPadTM has a 32-bit CPU. This means that the microcontroller unit is optimized to perform single precision floating point arithmetic operations. As explained before, it is expected that the inaccuracy of the results between the simulations of the algorithm in Simulink and the algorithm on the processor are negligible. Master of Science Thesis Morteza Haghayegh 82 Testing of the ADC Algorithm Processor Test Set-up For the testing of the ADC algorithms on the processor, first an overview of the arithmetic operations used for the algorithms in Simulink is generated. This is given in table 6-2. Table 6-2: Overview of the Simulink functions used in the ADC algorithms Operation Mode determination algorithm EKF time propagation algorithm EKF measurement update algorithm (2x) Detumble mode Velocitypointing mode control algorithm Addition, subtraction Gain Cross product 3x1 vectors Dot product Matrix multiplication Matrix exponential Matrix transpose Matrix inverse Square-root Trigonometric function 1 2 5 0 11 0 0 21 1 9 0 1 0 41 1 0 0 0 5 2 11 0 0 0 11 0 2 0 0 0 0 1 6 0 0 0 0 0 1 0 0 1 2 0 0 0 0 0 4 9 The Cortex-M4 CPU of the board is able to perform basic arithmetic operations as well as trigonometric functions and common math functions such as the square-root function. This is given in the documentation of the Tiva C Series microcontroller [41]. What remains to be investigated are the matrix operations. These matrix operations are used in the time propagation step of the EKF algorithm. Therefore for the processor tests it has been chosen to test the algorithm which performs the time propagation step, because it contains the Simulink blocks which need to be investigated for correct performance. The parameters and satellite properties that will be used for running tests on the processor of the time propagation step algorithm are: the moment of inertia J is given in table 2-1, the sensor measurement update frequency ∆t is 0.5 seconds and the initial quaternion and angular velocity are given as follows: 0.378 −0.378 q0 = 0.756 (6-2) 0.378 5◦ 0.0873rad ω 0 = 5◦ = 0.0873rad 5◦ 0.0873rad Morteza Haghayegh Master of Science Thesis 6-2 Algorithm Testing 83 Analysis Processor Testing Running a the test on the processor, shows that executing the matrix exponential function in C results in an error, while the other matrix operations are executed without errors. Instead of using the converted code of the matrix exponential Simulink block in C, an approximation of the matrix exponential will be used. The matrix exponential function can be defined as follows: let X be an n×n real or complex matrix, then the exponential of matrix X is the n×n matrix given by the power series [13]: eX = ∞ X 1 k! k=0 Xk (6-3) To check the performance of the time propagation step algorithm in Simulink using the approximation of the matrix exponential, three simulations will be executed, namely: • A simulation of the time propagation step using the matrix exponential function of the Simulink toolbox library. • A simulation of the time propagation step using an approximation of the matrix exponential function for k = 0,1,2. • A simulation of the time propagation step using an approximation of the matrix exponential function for k = 0,1. The performance of the EKF in Simulink with the varying matrix exponential functions are given in table 6-3. For all three cases the angular pointing error is below 10 degree during the second half of the Sunlit phase. Therefore it can be concluded that the pointing requirement is still met in all three cases. The table shows that the angular estimation error increases with 0.2 and 0.3 degree when the matrix exponential function is approximated using k = 0,1,2 and k = 0,1, respectively. The approximation with k = 0,1,2 has an increased computational effort of one matrix multiplication of two 4×4 matrices compared to the approximation with k = 0,1 which is insignificant compared to the total amount of 34 matrix multiplications used throughout the algorithm. Therefore the matrix exponential function on the processor will be approximated by taking the power series sum for k is equal to 0,1,2, because it provides a slightly higher accuracy without a high increase in computational intensity. Table 6-3: Angular estimation error [deg] during Sunlit phase between the second last and last eclipse for a Simulink simulation of 7 orbits Simulation type δestimation [deg] average δestimation [deg] maximum matrix exp simulink block approximation of matrix exp (k=0,1,2) approximation of matrix exp (k=0,1) 1.5 1.7 1.8 2.6 2.6 2.7 A test on the processor of the time propagation step algorithm for one loop is shown in table 6-4. The second column shows the output of the time propagation step when running the algorithm in Simulink with the matrix exponential Simulink block. The third column shows Master of Science Thesis Morteza Haghayegh 84 Testing of the ADC Algorithm the output of the time propagation step when running the algorithm on the processor with the approximation of the matrix exponential function using k = 0,1,2. The fourth column shows the error between the two outputs. There is an error observable in the output of the quaternion which is caused by the approximation of the matrix exponential. This error results in a higher angular estimation error as found with a simulation of the EKF in Simulink (table 6-3). However, the satellite will still be able to meet the pointing requirements as discussed in the previous paragraph. Table 6-4: Output of algorithm in Simulink using the standard matrix exponential simulink block and an approximation to the matrix exponential function Variable Output using matrix exp simulink block Run in Simulink Output using approximation of matrix exp (k = 0,1,2) Run on the processor Error q1 q2 q3 q4 ω1 ω2 ω3 0.361234182071317 -0.361234182071317 0.780203561328580 0.361234182071317 0.087300000000000 0.089932809272727 0.084667190727273 0.361230220535625 -0.361230220535625 0.780209391071250 0.361230220535625 0.087300000000000 0.089932809272727 0.084667190727273 0.000003961535692 -0.000003961535692 -0.000005829742670 0.000003961535692 0.000000000000000 0.000000000000000 0.000000000000000 6-3 Recommended Testing This chapter has focussed on testing the algorithm using a SIL test and a part of the EKF algorithm on the processor. For further testing it is recommended to perform a hardware-inthe-loop (HIL) test of the algorithm on the flight hardware. For this HIL testing the ADC algorithm will run on the flight hardware in a closed loop with the space environment and spacecraft dynamics models in Simulink, as depicted in figure 6-17. The code of case B1 will be used as the ADC algorithms in the HIL tests. The angular pointing error can be used to evaluate the performance of the ADC algorithm. It is important to check whether the time to execute the algorithms does not exceed the allocated time as indicated in table 5-1 which is almost equal to zero. In practice this translates to a few microseconds. Morteza Haghayegh Master of Science Thesis 6-3 Recommended Testing 85 Space Environment & Spacecraft Dynamics Models in Simulink Geomagnetic field vector and Sun direction vector Magnetic dipole moment ADCS microcontroller Figure 6-17: Hardware-in-the-loop testing of the ADC algorithm Master of Science Thesis Morteza Haghayegh 86 Morteza Haghayegh Testing of the ADC Algorithm Master of Science Thesis Chapter 7 Conclusions & Recommendations This thesis has presented the design of the algorithms for attitude determination and control and implementation and testing of this algorithm. The algorithm has been divided into control modes and one safe mode. The control modes are divided into a detumble mode and a velocity pointing mode. The Bdot controller for the detumble mode will be detumbling the satellite by decreasing the change in the geomagnetic field vector. The velocity-pointing mode will determine the desired attitude and will control the attitude to meet this desired attitude using a PD controller. The velocity-pointing mode will also include an extended Kalman filter (EKF) which will estimate the attitude and the rotation rate of the satellite. These modes will be initiated using a mode determination algorithm. This algorithm uses the tumble parameter and external parameters, such as the parameter which determines whether the safe mode is on or off. For the purpose of testing the control mode algorithms and the mode determination algorithm, the Simulink model will contain a model of the space environment and the spacecraft dynamics and kinematics. For determining the performance of the algorithm on the processor, the algorithm will be converted to C code and will be tested using a software-in-the-loop test and a test on the processor which resembles the flight hardware’s specifications. The objective of this thesis is to design, implement and verify the ADC algorithms which will run on the DelFFi satellites.For this objective two research questions have been formulated which will be discussed in the following two paragraphs. What are the performance issues associated with the ADC algorithm in case of nominal, non-nominal and practical conditions? In order to answer this question, extensive analysis has been performed on the algorithm for the detumble mode and the velocity-pointing mode. The answer will be therefore split up into two parts, where each part will discuss one of the modes. Master of Science Thesis Morteza Haghayegh 88 Conclusions & Recommendations Detumble Mode The detumble mode is influenced by the time to complete one ADCS loop. By reducing the total loop time, the responsiveness of the ADCS improves. In addition, the rate at which the detumble mode converges to a fully detumbled satellite is dependent on the ratio of actuator time over total sampling time. This parameter determines the effectiveness of the magnetic torquers. From the analysis of the non-nominal conditions it can be concluded that a 10 times increase in the noise of the magnetometer increases the angular velocity, but the satellite can still be detumbled. Furthermore, it can be concluded that decreasing the altitude from 380 km to 200 km does not have a significant effect on the performance of the detumble mode. This shows that even though the disturbance torques increase for a lower orbit, it does not outweigh the effect of the higher geomagnetic field strength which increases the control torque. Moreover, it can be shown that the satellite will not be able to detumble if it can not produce a torque around the x axis or if it can not produce a torque around both the y and z axes. This can occur in the case of a failure of the components of magnetic torquers in one of the axes. Velocity-Pointing Mode For the velocity-pointing mode it has been decided to use a PD controller and an EKF. It is, however, important to choose suitable control gain parameters and attitude estimation parameters to improve the performance of the controller and estimator. From the analysis of the non-nominal conditions it can be concluded that increasing the inaccuracy of the IGRF look-up table decreases the performance of the attitude estimation filter. This inaccuracy is equivalent to a look-up value every 1 degree in longitude and latitude instead of a value for every combination of latitude and longitude. However, for both this inaccuracy and an inaccuracy two times higher it was shown that the satellite can still point in the desired attitude using the velocity-pointing mode. Moreover, it has been concluded that an inaccuracy in the moment of inertia results in minimal changes to the pointing performance. This is because the moment of inertia is only used in the time propagation step algorithm. This time propagation step algorithm is relied upon heavily during the eclipse periods. However, during the Sunlit phases the Sun direction vector is available which improves the estimation performance and therefore the estimation algorithm does not rely on the time propagation step as much as in the eclipse period. In addition, also analysis has been performed for the case that the formation flying concept will be demonstrated during velocity-pointing mode. It has been determined that the best time to fire the thruster is just before eclipse. This is the time where the pointing performance is at its maximum due to the fact that the satellite has been in the Sunlit phase for the longest consecutive amount of time, which results in the Sun direction vector providing the best estimation performance. Furthermore, firing the thruster just before eclipse means that the entire eclipse period can be used to detumble the satellite since it is not possible to start the velocity-pointing mode during eclipse due to the low estimation performance. It has been shown that the reaction wheels are essential for the formation flying concept due to the fact that, for the velocity-pointing Morteza Haghayegh Master of Science Thesis 89 mode where the magnetic torquers are used exclusively, the pointing error increases rapidly when the thrusters are fired. This results in a poor pointing performance of the thrusters for a large part of the thrusting phase. The velocity-pointing mode will not meet the requirement to point in the velocity vector at all times due to the availability of only one reference vector in eclipse periods. A suggestion to solve this has been given in the recommendations section of this chapter. What are the sources of errors when running the ADC algorithm on the microcontroller and how can these be mitigated? Code generation from a pre-designed algorithm is a very attractive means of producing code for a processor, because it results in re-usability of the code. In order to avoid some typical drawbacks with this code, the problems of shared-data problem and task overruns have been solved. The shared-data problem has been solved by designing the Simulink code in a way that the algorithm is atomic. The problem of task overrun has been solved by setting flags at appropriate locations in the code. If a flag has been enabled, meaning that the task is not finished yet, then the code will continue to run and skip the next task until the current task has been finished. The best coding architecture which has been determined with a software-in-the-loop test is the architecture where all algorithms are separately converted in C code. These algorithms are the mode determination, safe mode, detumble mode, velocity-pointing mode control and the EKF. In addition also the three phases of the EKF, namely the time propagation step and the two measurement update steps, are separately converted in C code. This architecture avoids two issues: • Simulink memory blocks will be used in the EKF, which are designed to store the value of the output of the filter. By implementing the Simulink memory block manually in the C code instead of converting the memory block directly into C code, the problem of storing values will be solved. • Generating the entire code into one single C file causes issues in the execution of the counter code. This counter is designed to count the amount of time since the tumble parameter Ptumble is below the detumble limit Ldetumbled . When this counter reaches a certain value, equal to tdetumbled , the mode determination algorithm will determine that the satellite has been detumbled and sets the mode to the velocity-pointing mode. When the velocity-pointing mode is initiated, this counter needs to reset. Converting the entire code into one single C file will cause that this counter code is reset after every loop, even if the control mode is set to the detumble mode. This is because the counter code will not be able to determine if the mode has been switched. By separating the C code into smaller code, the counter will be able to determine that the mode has been switched. This will result in the counter executing without errors. Now that the coding issues have been solved, it is time to move on to the limitations of the processor. The processor will not have problems with running the basic arithmetic operations as well as the trigonometric and math functions. However, the matrix operation Master of Science Thesis Morteza Haghayegh 90 Conclusions & Recommendations that calculates the matrix exponential did not run correctly. This issue has been solved by approximating the matrix exponential function with a power series. When approximating this function some inaccuracy is introduced, but this inaccuracy did not reduce the pointing performance of the algorithm. Recommendations This section will provide the recommendations on a software and hardware level related to the analysis performed in this thesis. • The parameters for the mode determination algorithm need to be able to be changed insitu. This is because these parameters change for a changing noise of the magnetometer measurements. • To reduce the noise of the magnetometer measurements, the distance between the magnetometer and the magnetic torquers should be as large as possible. • Additional attitude determination sensors are needed to increase the angular estimation accuracy during eclipse such as a gyroscope or a Earth horizon sensor. • The ADC algorithms presented in this thesis need to be tested with the flight hardware which still needs to be produced. A hardware-in-the-loop test can be used for this purpose. Morteza Haghayegh Master of Science Thesis Appendix A DelFFi ADCS Requirements A-1 List of Requirements This section of the appendix presents the relevant ADCS requirements for the DelFFi satellite Master of Science Thesis Morteza Haghayegh 92 DelFFi ADCS Requirements Table A-1: DelFFi Requirements Specification List Part 1 [9] Config. Item Cat. Nr. Configuration Item Description SYS.1.2.1 P 01 QB50 SYS.1.2.1 P 02 QB50 MIS F 01 DelFFi Mission MIS MIS F C 02 DelFFi Mission M.1 DelFFi Mission The Cubesat shall be able to recover from tip-off rates of up to 50 deg/s within 3 days (nominal conditions) The CubeSats carrying the science sensors shall have an attitude control with pointing accuracy of 10 degree and pointing knowledge of 2 degree from its initial launch altitude at 380 km down to at least 200 km. The mission shall facilitate Autonomous Formation Flying (AFF) payload. The mission shall facilitate standard QB50 payload. The QB50 payload shall only be making observations at orbit velocity direction. Both satellites ADCS shall provide three axis stabilization All satellite systems shall be able to withstand the space environment. The Science Unit will be accommodated at one end of the CubeSat, on a 10 mm 10 mm face. The -Z face using the CubeSat reference frame. The vector normal to this face shall be in the spacecraft ram velocity direction. The face shall not be available for solar cells, or for any other subsystem and nothing must forward this face. The ADCS shall perform active attitude determination and control capabilities in three axes. The ADCS shall be equipped with coarse attitude sensors for coarse onboard attitude (re-)determination around all spacecraft body axes. The ADCS shall integrate the input from the ADCS sensors and generate actuator commands. MIS SAT M.2 DelFFi Mission C 07 SAT.2.2 SAT.2.2 DelFFi Satellite ADCS F 01 ADCS SAT.2.2 ADCS SAT.2.2 ADCS Morteza Haghayegh Master of Science Thesis A-1 List of Requirements 93 Table A-2: DelFFi Requirements Specification List Part 2 [9] Config. Item Cat. Nr. Configuration Item SAT.2.2 ADCS SAT.2.2 ADCS SAT.2.2 ADCS SAT.2.2 ADCS SAT.2.2 ADCS SAT.2.2 ADCS SAT.2.2 ADCS SAT.2.2.1.1 C 01 Magnetometer SAT.2.2.1.1 F 01 Magnetometer SAT.2.2.1.1 F 02 Magnetometer SAT.2.2.1.1 I 01 Magnetometer SAT.2.2.1.1 I 02 Magnetometer SAT.2.2.1.1 I 03 Magnetometer SAT.2.2.1.1 P 01 Magnetometer Master of Science Thesis Description The ADCS shall be able to provide attitude information with no worse than 1 deg accuracy around the various body axes using fine attitude sensors. The ADCS shall have actuators capable of providing torques around all spacecraft body axes with sufficient accuracy for data collection of all payloads. Attitude and rate estimates shall be determined by the ADCS subsystem in every attitude mode, with input from the AFF payload and ADCS sensors. The ADCS shall control the attitude actuators with sufficient frequency to allow the required pointing stability to be obtained. Detumbling mode is activated when the S/C rate is above 1 deg/s. The ADCS shall use rate estimates and actuators to reduce the rate below 1 deg/s. Coarse attitude acquisition mode is activated when the S/C rate is below 1 deg/s and above 0.5 deg/s. The ADCS shall use rate and angle estimates and actuators to reduce the rate below 0.5 deg/s, and the attitude from any attitude to within 10 deg of the target. Safe mode is activated by TC or by on-board autonomy in cases where other modes are considered a hazard to the spacecraft or its operability. It shall provide the safest possible orientation (e.g. a spin around the radial axis, barbeque mode or solar panels sun pointing). The magnetometers must be able to operate in a magnetic field between 19.8 µT and 46.9 µT. The magnetometers shall measure their position with respect to the Earth’s magnetic field. The magnetometers shall provide measurement data in three axes. The magnetometer shall comply to the interfaces with the read-out electronics and/or microcontroller. The magnetometer shall comply to the interface with the electrical power supply (Vcc of 3.3V preferred). The magnetometer shall not be sensitive to interference from other satellite systems or components. The magnetometers in combination with their readout electronics must have a minimum accuracy of 3 degrees, i.e. the magnetometers need a minimum resolution of 0.66 µT. Morteza Haghayegh 94 DelFFi ADCS Requirements Table A-3: DelFFi Requirements Specification List Part 3 [9] Config. Item Cat. Nr. Configuration Item Description SAT.2.2.2.1 C 01 Magnetometer SAT.2.2.2.1 F 01 Magnetic Torquer SAT.2.2.2.1 P 01 Magnetic Torquer SAT.2.2.2.2 F 01 Magnetic Torquer SAT.2.2.2.2 F 02 Wheel SAT.2.2.2.2 F 03 SAT.2.2.2.2 F 04 Reaction System Reaction System Reaction System SAT.2.2.2.2 F 05 Wheel SAT.2.2.2.2 I 01 SAT.2.2.2.2 I 02 SAT.2.2.2.2 I 03 SAT.2.2.2.2 P 01 SAT.2.2.2.2 P 02 Reaction System Reaction System Reaction System Reaction System Reaction System Reaction System The magnetorquers shall always be operable, except when measuring the Earth’s magnetic field using the magnetometers. The magnetic rise and fall time should be within 5ms to allow several measurement per second. At least 3 magnetorquers are required for three-axis active attitude control. Each magnetorquer must deliver a magnetic moment that is variable between at least TBD and TBD A·m2 around each axis. The Reaction Wheel System shall facilitate satellite attitude control about all three principal axes. The Reaction Wheel System shall be able to generate torques about all three principal axes instantanously. The Reaction Wheel System shall be able to handle commands from the central ADCS microprocessor. The Reaction Wheel System shall generate reliable information about the stored angular momentum among all three principal axes. The Reaction Wheel System shall not have a negative impact on the stability of the satellite. The reactionwheels shall comply to the interface with the electrical power supply (Vcc of 3.3V preferred). The reactionwheels shall comply to the interfaces with the read-out electronics and/or microcontroller. Alignment of each individual reaction wheel shall be better than 2.5 deg with respect to each principal axis. The reactionwheels shall be able to generate a minimum torque of TBD N·m (about each individual axis) The reaction wheels shall be able to store angular momentum over a dynamic range of TBD N·m·s about each individual axis. Morteza Haghayegh Wheel Wheel Wheel Wheel Wheel Wheel Wheel Master of Science Thesis A-1 List of Requirements 95 Table A-4: DelFFi Requirements Specification List Part 4 [9] Config. Item Cat. Nr. Configuration Item Description SAT.2.2.2.2 P 03 SAT.2.2.2.2 P 04 SAT.2.2.2.2 P 05 SAT.2.2.2.2 P 06 The reaction wheels shall not generate systemic disturbance torques above 1.0·10−8 N·m. The reaction wheels shall not generate instantaneous disturbance torques above 1.0·10−7 N·m. The Reaction Wheel System shall be able to control the angular momentum about each individual axis with a minimum accuracy of 2.0·10−7 N·m·s (based on a 0.5 Hz ADCS control frequency). The Reaction Wheel System shall be able to determine the angular momentum about each individual axis with a minimum accuracy of 2.0·10−8 N·m·s (based on a 0.5 Hz ADCS control frequency). Reaction System Reaction System Reaction System Wheel Reaction System Wheel Wheel Wheel The requirement types are abbreviated as follows • C = Constraint: this requirements puts constraints on a configuration item • F = Functional: this requirement specifies the functionality of a configuration item • G = General: this requirement is not belonging to any of the other categories • I = Interface: this requirement specifies the (type of) interface of a configuration item • O = Operational: this requirement specifies an operational mode • P = Performance: this requirement specifies the (minimum) performance of a configuration item Note that some requirements are numbered with the letter ’M’ followed by the number. This indicates that these requirements have not been numbered correctly in the original requirements list and will get a unique identification number for reference purposes. Master of Science Thesis Morteza Haghayegh 96 A-2 DelFFi ADCS Requirements ADCS Requirements of the DelFFi Mission This section gives the ADCS requirements as found in the Requirements document of the DelFFi project [9]. For this thesis the function and the amount of ADCS modes will be changed to meet the changed configuration of the satellite and the changed schedule of the mission. These ADCS requirements can be found in table A-5. Table A-5: ADCS Requirements DelFFi Mission ([9]) ADCS Modes Threshold Control objective Sensors Actuators Processor De-tumbling Nadir pointing Sun pointing (optional) Thrust vector control Safe >1◦ /s 1◦ /s <1◦ /s <1◦ /s; By command By command By command <1◦ /s; <10◦ <1◦ /s; <2◦ No MM MM, SS MM, SS MM, SS MM MTQ MTQ MTQ RW, MTQ No ARM9 ARM9 ARM9 ARM9 ARM9 Morteza Haghayegh <10◦ Master of Science Thesis Appendix B Additional Equations, Derivations and Functions B-1 Arccosine2 Function The acos2 function will be used throughout this report. The acos2 function will extend acos as it can deliver angles ranging from 0 to 360 degrees. An extra variable H is needed, which is equal to the sign of the second component of the angle. acos2 (x, H) = mod (real (H · acos (x)) , 2π) B-2 (B-1) Angular Pointing Error and Angular Estimation Error The angular pointing and estimation error is defined as the angle between Euler eigenaxis of two quaternions. The angular error δ between the Euler eigenaxis of two quaternions q1 and q2 is then defined as: q̃ = q2 −1 × q1 δ = 2 · acos (q̃4 ) Master of Science Thesis (B-2) Morteza Haghayegh 98 Morteza Haghayegh Additional Equations, Derivations and Functions Master of Science Thesis Bibliography [1] Q. Chu, “Spacecraft Dynamics And Control Lecture Notes,” 2012. [2] R. Schoemaker, “Robust and Flexible Command and Data Handling on board the DelFFi Formation Flying Mission,” Master of Science Thesis, 2014. [3] E. Mooij and A. in ’t Veldt, “Flight Dynamics Lecture Notes (3rd year Aerospace Engineering course),” 2011. [4] J. Davis and V. Tech, “Mathematical Modelling of Earths Magnetic Field,” 2004. [5] Delfi Project Team, “DFF-TUD-TN-1141 [0.3] DelFFi ADCS - Disturbances torques,” 2014. [6] Delfi Project Team, “DNX-TUD-TN-0220 [4.5] ADCS - Magnetorquer Design,” 2012. [7] J. Guo, “DelFFi CubeSat Design Overview Report.” [8] W. Wu, “Design of the Reaction Wheels for the DelFFi Satellite,” Master of Science Thesis, 2015. [9] J. Guo, “DelFFi Requirements & Configuration Item List,” tech. rep., 2013. [10] J. Reijneveld, “Design of the Attitude Determination and Control Algorithms for the Delfi-n3Xt,” Master of Science Thesis, 2012. [11] J. Guo, “DelFFi System Overview,” 2014. [12] J. Verwilligen, “DFF-TUD-TN-xxxx COMMS - EM Interaction,” 2015. [13] D. Lay, Linear Algebra and Its Applications. 2006. [14] B. Wie, Space Vehicle Dynamics and Control. 2008. [15] J. Wertz, Spacecraft Attitude Determination and Control. 1990. [16] R. Schwarz, “Keplerian Orbit Elements to Cartesian State Vectors,” Technical Note. Master of Science Thesis Morteza Haghayegh 100 Bibliography [17] D. Vallado, Fundementals of Astrodynamics and Applications. Space Technology Library, 2001. [18] R. Poyck, “Design, manufacturing and characterisation of a water fed CubeSat microresistojet,” Master of Science Thesis, 2014. [19] T. M. A. Habib, “A comparative study of spacecraft attitude determination and estimation algorithms,” Aerospace Science and Technology, vol. 26, pp. 211–215, Apr. 2013. [20] R. Kalman, “A new approach to linear filtering and prediction problems,” Research Institute for Advanced Study, vol. 82, pp. 35–45, 1960. [21] D. Choukroun and Y. Oshman, “Novel Quaternion Kalman Filter,” AIAA Guidance, Navigation and Control Conference, vol. 42, no. 1, 2006. [22] T. Inamori, “In-orbit magnetic disturbance estimation and compensation using UKF in nano-satellite mission,” AIAA Guidance, Navigation and Control Conference, no. August, pp. 1–15, 2009. [23] Y. Yang, “Spacecraft attitude determination and control: Quaternion based method,” Annual Reviews in Control, vol. 36, no. 2, pp. 198–219, 2012. [24] M. Afonso, “Particle Filter and Extended Kalman Filter for Nonlinear Estimation: A Comparative Study,” no. March, p. 10, 2008. [25] J. L. Crassidis, F. L. Markley, and Y. Cheng, “Survey of Nonlinear Attitude Estimation Methods,” Journal of Guidance, Control, and Dynamics, vol. 30, pp. 12–28, Jan. 2007. [26] J. J. LaViola, “A comparison of unscented and extended Kalman filtering for estimating quaternion motion,” Proceedings of the 2003 American Control Conference, vol. 3, 2003. [27] E. Silani and M. Lovera, “Magnetic spacecraft attitude control: a survey and some new results,” Control Engineering Practice, vol. 13, pp. 357–371, Mar. 2005. [28] P. J. Camillo and F. Markley, “Orbit-averaged behaviour of magnetic control laws for momentum unloading,” Journal of Guidance and Control, vol. 3, no. 6, pp. 563–568, 1980. [29] S. Beatty, “Comparison of PD and LQR Methods for Spacecraft Attitude Control,” Technical Note University of New Mexico (US), 2012. [30] T. Xiang, T. Meng, H. Wang, K. Han, and Z.-H. Jin, “Design and on-orbit performance of the attitude determination and control system for the ZDPS-1A pico-satellite,” Acta Astronautica, vol. 77, pp. 182–196, Aug. 2012. [31] Y. Jan and J. Chiou, “Attitude control system for ROCSAT-3 microsatellite: a conceptual design,” Acta Astronautica, vol. 56, pp. 439–452, Feb. 2005. [32] J. Reijneveld and D. Choukroun, “Attitude control system of the Delfi-n3Xt satellite,” Progress in Flight Dynamics, Guidance, Navigation, Control, Fault Detection, and Avionics, vol. 6, pp. 189–208, Dec. 2013. Morteza Haghayegh Master of Science Thesis 101 [33] J. Ziegler, N. Nichols, and N. Rochester, “Optimum Settings for Automatic Controllers,” Journal of Dynamic Systems, Measurement and Control, vol. 115, no. 2B, pp. 220–222, 1942. [34] B. Wie and H. Weiss, “Quaternion Feedback Regulators for Spacecraft Eigenaxis Rotation,” Journal of Guidance, Control and Dynamics, vol. 12, no. 3, p. 375, 1989. [35] QB50, “System Requirements and Recommendations by Von Karman Institute,” no. 6, 2014. [36] QB50, “System Requirements and Recommendations by Von Karman Institute,” no. 7, 2015. [37] E. de Angelis, “Mechanical and Magnetic actuation of the ESEO Satellite,” PhD. Thesis, 2013. [38] T. V. Boxtel, “Thermal modelling and design of the DelFFi satellites,” Master of Science Thesis, 2015. [39] C. Bunse and C. Peper, “Applying a Model-based Approach for Embedded System Development,” no. Seaa, 2007. [40] J. Viru, “DelFFI ADCS Processor Selection,” Technical Note, 2014. [41] M. Morales, “An Introduction to the Tiva C Series Platform of Microcontrollers,” pp. 1– 6, 2013. [42] E. Denney, “Certifying Auto-generated Flight Code,” tech. rep. Master of Science Thesis Morteza Haghayegh 102 Morteza Haghayegh Bibliography Master of Science Thesis

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement