Table Of ContentSoftware Design and Controller
Evaluation for the ADCS on the NTNU
Test Satellite
Marius Fløttum Westgaard
Master of Science in Cybernetics and Robotics
Submission date: July 2015
Supervisor: Jan Tommy Gravdahl, ITK
Norwegian University of Science and Technology
Department of Engineering Cybernetics
i
Problem Description
TheNTNUTestSatelliteprojectwasstartedinSeptember2010,thegoalistobuildalaunch
ready double CubeSat. This thesis aims to further develop the Attitude Determination and
ControlSystemtoanearflightreadyversion.
• Simulatethesatellitewiththepreviouslychosenpointinganddetumblingcontrollers
to see how they perform with the current actuator and software design. Retune con-
trollersifnecessary.
• Simulatethepointingcontrollerwhentherearenoiseontheangularvelocitymeasure-
mentstocheckrobustness.
• Design,evaluateandsimulateacontrollertoincreasetheangularvelocityofthesatel-
lite,atumblingcontroller.
• DesignasecondAttitudeDeterminationandControlSystemhardwareprototype. The
second prototype will be based on the first prototype, but with additional sensors
addedforredundancy.
• Design the overall software architecture for the Attitude Determination and Control
System.
• Findandimplementanalgorithmtocalculatethebestvalueforthedataprovidedby
thesensorsthathavehardwareredundancy.
• PerformafailureanalysisfortheAttitudeDeterminationandControlSystemtoshow
howitmightfailandhowitcanbeavoided.
Tobehandedinby: 13.07.2015
Supervisor1: ProfessorJanTommyGravdahl
Supervisor2: RogerBirkeland
ii
Abstract
TheNTNUTestSatelliteisastudentsatelliteprogramatNTNUthatispartoftheNorwegian
Student Satellite Program run by the Norwegian Center for Space Related Education. The
goaloftheprojectistosendastudentbuiltanddesignedCubeSattospace. Thisthesiscon-
tinues the work of developing a Attitude Determination and Control System for the NTNU
TestSatellite.
Inthisthesissimulationshavebeenrunfortwopreviouslychosencontrollers(detumbling
andpointing)toensurethatthecontrollerswillworkwiththehardwareandsoftwaredesign
of the Attitude Determination and Control System. A third controller has been developed
toincreasetheangularvelocityofthesatellite,calledatumblingcontroller,andsimulations
have been performed to check its performance. Simulations have also been performed to
checkhowthepointingcontrollerworkswhentherearenoiseontheangularvelocitymea-
surements.Thesimulationsshowsthatallofthecontrollerswillworksatisfactory.Instability
evidenceisalsopresentedforthetumblingcontroller.
AsecondprototypefortheAttitudeDeterminationandControlSystemhardwarehasbeen
designed with a focus on redundancy, and the overall software architecture has been de-
signed. Mostofthesoftwarehavebeentestedonaevaluationkitforthechosenmicrocon-
troller. Amedianvoterhasbeenimplementedtohandlethesensorredundancyinsoftware.
Lastlyasimplefailureanalysishavebeenperformed,faulttreeshavebeenusedtoshowhow
the Attitude Determination and Control System might fail to perform as designed. Some
stepsthatcanbetakentoreducetheriskoffailuresarealsodiscussed.
iii
Sammendrag
NTNU Test Satellitt er et student satellitt program på NTNU som er del av det norske stu-
dent satellitt programmet drevet av nasjonalt senter for romrelatert opplæring. Målet med
prosjekteteråsendeenstudentbyggetogdesignetCubesattilverdensrommet. Denneopp-
gaven fortsetter arbeidet med å utvikle et Attitude Determination and Control System for
NTNUTestSatellitt.
I denne oppgaven har simuleringer blitt kjørt for de tidligere valgte kontrollerne (detum-
blingogpointing)foråsjekkeatdevirkermedhardwarenogsoftwarendesignettilAttitude
DeterminationandControlSystemet. Entredjekontrollerharblittutvikletforåøkevinkel-
hastigheten til satellitten, kalt en tumbling kontroller, simulering har også blitt utført for å
testedenne. Simuleringharogsåblittgjortforåsjekkehvordanpoiningkontrollerenvirker
når det er målestøy på vinkelhastigheten. Simuleringen har vist at alle kontrollerne virker.
Bevispåustabiliteterogsåpresentertfortumblingkontrolleren.
EnnyprototypeharblittutvikletforAttitudeDeterminationandControlSystemhardwaren
medetfokuspåredundans. Denoverordnedesoftwarearkitekturenharogsåblittdesignet.
Mestepartenavsoftwarenharblitttestetpåetevaluasjonskitfordenvalgtemicrocontrolleren.
En median voterings algoritme har blitt implementert for å behandle redundansen i soft-
ware.Tilsistharenkortfeilanalyseblittgjennomført,feiltrærharblittbruktforåvissehvor-
dan Attitude Determination and Control System kan slutte å fungere som designet. Noen
alternativerforåredusererisikoenforfeilharogsåblittdiskutert.
iv
Acknowledgement
IwouldliketothankHenrikRudiHaaveandAntoineFrançoisXavierPignèdewhohavealso
worked on the Attitude Determination and Control System for the NTNU Test Satellite for
theirsupportandcooperationthislastyear.
I would also like to thank Amund Gjersvik who works on the NTNU Test Satellite project
forhelpingwithdesignoftheAttitudeDeterminationandControlSystemhardware,andthe
projectleaderRogerBirkelandforhishelp.
Lastly I would like to thank my supervisor professor Jan Tommy Gravdahl for the help and
guidancehehasgivenduringthesemester, andprofessorAmundSkavhaugfortheinvalu-
ableguidanceonthesoftwareside.
Contents
ProblemDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
Abstract. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Sammendrag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Acknowledgement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
1 Introduction 1
1.1 NUTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 PreviousWork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 ContributionsofthisThesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 ThesisOutline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 BackgroundTheory 7
2.1 ReferenceFrames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Earth-CenteredInertialFrame . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2 Earth-CenteredEarth-FixedFrame . . . . . . . . . . . . . . . . . . . . . . 8
2.1.3 OrbitFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.4 Body-FixedFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 AttitudeRepresentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 TheRotationMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.2 EulerAnglesandQuaternions . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 SatelliteTheory 13
3.1 SatelliteDynamicsandKinematics . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2 Magnetorquers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3 EnvironmentalDisturbances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4 ErrorSources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
v
vi CONTENTS
4 Control 19
4.1 B-DotEstimator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2 DetumblingController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.3 PointingController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.4 TumblingController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.4.1 Instability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.5 PulseWidthModulationandControllerTiming . . . . . . . . . . . . . . . . . . . 28
5 Simulations 33
5.1 Detumbling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.2 Pointing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.2.1 WithoutMeasurementNoise . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2.2 WithMeasurementNoise . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.3 Tumbling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6 Hardware 51
6.1 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.1.1 Magnetometers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.1.2 Gyroscopes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.1.3 SunSensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.2 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.3 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.4 ADCSPrototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
7 Software 57
7.1 OperatingSystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.2 FreeRTOSScheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.3 FreeRTOSTasksandTaskCommunication . . . . . . . . . . . . . . . . . . . . . . 58
7.4 Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.5 PersistentVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.6 Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.7 SoftwareArchitecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7.7.1 States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.7.2 Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CONTENTS vii
7.7.3 Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.7.4 DataSharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
8 SensorRedundancyAlgorithm 67
8.1 VotingAlgorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
9 FailureAnalysis 71
9.1 FaultTreeAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.2 FailurePrevention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
10 DiscussionandResults 77
10.1 ControllersandSimulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
10.2 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
10.3 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
10.4 SensorRedundancyAlgorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
10.5 FailureAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
11 Conclusion 83
12 FutureWork 85
A DataStructures 87
B Messages 91
C SequenceDiagrams 93
viii CONTENTS
Description:The NTNU Test Satellite is a student satellite program at NTNU that is part of the Norwegian. Student Satellite Program run by the Norwegian Center for Space Related Education. The goal of the project is to send a student built and designed CubeSat to space. This thesis con- tinues the work of