satellite attitude control - aalborg...

87
Satellite Attitude Control Using Magnetorquers with Magnetic Dipole Moment Cancellation Master Thesis Rasmus Holst Aalborg University, 2014

Upload: others

Post on 26-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

SatelliteAttitudeControl

Using Magnetorquerswith Magnetic Dipole Moment Cancellation

Master Thesis

Rasmus Holst

Aalborg University, 2014

Page 2: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 3: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Institute of Electronic SystemsControl EngineeringFredrik Bajers vej 79220 Aalborg ØstPhone 99 40 86 00http://es.aau.dk

Title:Satellite Attitude Control Using

Magnetorquers With Mag-netic Dipole Moment Cancel-lation

Theme:Master’s thesis

Projectperiod:April 2014 to August 2014

Projectgroup:1035

Participants:Rasmus Holst

Supervisor:Jesper Abildgaard Larsen

Number of printed copies: 3

Number of pages: 87

Appendices: 3

Finished on: August 15, 2014

Synopsis:

This thesis describes the design and anal-ysis of a nonlinear attitude control systemfor a CubeSat sized satellite based on thestructure of the AAUSAT satellites.An analysis of the main disturbancesis made with the conclusion that onlythe magnetic dipole moment needs to betaken into account when performing at-titude control, as this disturbance is 10times larger than the rest combined.An estimation of the satellite dipole mo-ment is made as a bias estimation by anExtended Kalman Filter. The resultingestimate is correct within 8 % of the truedipole moment when estimating on databasen on a slowly tumbling satellite withstate noise.A sliding mode controller is used as thenonlinear controller and uses the mag-netic dipole estimate from the ExtendedKalman Filter to counteract this distur-bance. The result is a controller capa-ble of following a Nadir reference withinan axis-wise error of 10 degrees. Thedownside to the controller is the constantpower consumption needed, in order tocounteract the magnetic dipole momentof the satellite.

Page 4: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 5: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Preface

This thesis covers the development of a attitude control system designed forimplementation on a CubeSat sized satellite. The work is made as a Master’sthesis at the Department of Electronic Systems at Aalborg University in theperiod April 2014 to August 2014.

The calculations for the presented work are made in Matlab with the sim-ulations implemented in Simulink. The base structure of the Simulink modelis developed by previous project groups working on the AAUSAT project andmodified to work with the developed controller and disturbances. The imple-mented parameters and simulation structure are presented in appendix A.

A thank you should be given by the author to Associate Professor JesperA. Larsen for supervising the project throughout the project period. Furtherthanks should be given to the students who have previously been working onthe AAUSAT projects for the work of determining satellite parameters anddevelopment of simulation tools.

Rasmus Holst

v

Page 6: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 7: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Contents

I Introduction 3

1 Introduction 51.1 AAUSAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Coordinate Systems . . . . . . . . . . . . . . . . . . . . . . . . 61.3 Rotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

II Modeling 11

2 Kinematic and Dynamic Model 132.1 Kinematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.2 Dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3 Actuator and Disturbances 173.1 Magnetorquers . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.2 Gravitational Torque . . . . . . . . . . . . . . . . . . . . . . . . 183.3 Aerodynamic Drag . . . . . . . . . . . . . . . . . . . . . . . . . 203.4 Magnetic Residual Dipole . . . . . . . . . . . . . . . . . . . . . 223.5 Solar Radiation . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.6 Disturbance Comparison . . . . . . . . . . . . . . . . . . . . . . 24

4 Earth’s Magnetic Field and Controllability 254.1 Geomagnetic Field of Earth . . . . . . . . . . . . . . . . . . . . 254.2 Controllability . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

III Estimation and Control 29

5 Satellite Energy and Lyapunov Stability 315.1 System Energy . . . . . . . . . . . . . . . . . . . . . . . . . . . 315.2 Lyapunov Stability . . . . . . . . . . . . . . . . . . . . . . . . . 32

6 Magnetic Dipole Moment Estimation 356.1 Estimation Method . . . . . . . . . . . . . . . . . . . . . . . . . 356.2 Magnetic Dipole Estimation . . . . . . . . . . . . . . . . . . . . 35

7 Sliding Mode Controller 437.1 Sliding Mode Introduction . . . . . . . . . . . . . . . . . . . . . 437.2 Sliding Manifold Design . . . . . . . . . . . . . . . . . . . . . . 447.3 Sliding Condition Design . . . . . . . . . . . . . . . . . . . . . . 46

vii

Page 8: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

viii Contents

IV Results and Conclusion 49

8 Simulation Results 518.1 Sliding Mode Controller . . . . . . . . . . . . . . . . . . . . . . 518.2 Sliding Mode Controller with Perfect Disturbance Compensation 528.3 Sliding Mode Controller with Estimated Disturbance Compen-

sation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548.4 Sliding Mode Controller without Disturbance Compensation . . 56

9 Conclusion and Discussion 59

V Appendix 61

A Simulation Parameters and Overview 63

B Linear Controller 65

C Matlab Code for Sliding Mode Controller 73

Bibliography 77

Page 9: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

List of Figures

1.1 Exploded view of the AAUSAT satellite . . . . . . . . . . . . . . . 51.2 The used coordinate systems shown relative to each other. The

illustration is not scalable. . . . . . . . . . . . . . . . . . . . . . . . 61.3 Coordinate system within a reference coordinate system. . . . . . . 8

2.1 ρi: Vector from COM to a given mass i. R: Vector from Fr toCOM of Fs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.1 r: Vector from COM to a given mass i. ρn: Vector from COM inFr to mi in Fs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.2 Gravity gradient torque description . . . . . . . . . . . . . . . . . . 193.3 COM displacement causing maximum gravity gradient . . . . . . . 203.4 Satellite surface cutting through the wind . . . . . . . . . . . . . . 213.5 Maximum and minimum surface area . . . . . . . . . . . . . . . . . 213.6 Solar radiation and reflection on satellite surface . . . . . . . . . . 23

4.1 Magnetic field around Earth as a dipole. Figure provided by Wiki-media Commons . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.2 IGRF model showing field strength abnormalities [Wertz [1994]] . . 264.3 Magnetic field experienced by satellite in LEO. . . . . . . . . . . . 264.4 Desired torque projected down onto the plane perpendicular to the

B-field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

6.1 Kalman filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366.2 Satellite magnetic dipole estimation with EKF . . . . . . . . . . . 386.3 Satellite magnetic dipole estimation with EKF . . . . . . . . . . . 396.4 Satellite magnetic dipole estimation with EKF of noisy data. . . . 41

7.1 Phase portrait of a converging SMC. Illustration from [http://ej.iop.org]. 43

8.1 Simulation of Sliding Mode Controller. . . . . . . . . . . . . . . . . 528.2 Simulation of Sliding Mode Controller with perfect disturbance

compensation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548.3 Simulation of Sliding Mode Controller with estimated disturbance

compensation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558.4 Simulation of Sliding Mode Controller without disturbance com-

pensation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

A.1 Simplified simulation schematic . . . . . . . . . . . . . . . . . . . . 63

B.1 Satellite orbiting the origin of the Inertial frame . . . . . . . . . . . 66B.2 Overview of the controller. . . . . . . . . . . . . . . . . . . . . . . 68B.3 Magnetic field intensity of Earth [Wertz [1994]]. . . . . . . . . . . . 70B.4 Magnetic field captured in Orbit frame at polar orbit. . . . . . . . 71

ix

Page 10: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

x List of Figures

B.5 Simulation of the system with chosen weights. Top: Angular ve-locity. Middle: Error angles. Bottom: Produced torque. . . . . . . 72

Page 11: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Nomenclature

baA Rotation matrix from a to bB Magnetic field from EarthE Identity matrixI Inertia matrix

m Dipole momentΩ Vector containing angular velocitiesωo Orbit ratebaq Attitude quaternionq Imaginary part of a quaternionq4 Real part of a quaternion

S [·] Skew symmetric representationiv Vector in i-frame

q, Ω Time derivative of q, ΩV Lyapunov Candidate Function

1

Page 12: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 13: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Part I

Introduction

3

Page 14: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 15: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Introduction 1About the thesis

This thesis covers the devopment of a attitude control system designed forimplementation on a CubeSat sized satellite. The satellite used in this projectis a CubeSat satellite build at Aalborg University in the section of Automa-tion and Control. Furthermore the thesis also covers the estimation of thesatellite’s magnetic dipole moment, and will be used in the control structureto counteract the disturbance caused by this magnetic dipole.

1.1 AAUSAT

The AAUSAT-project is currently counting three launched satellites and fur-ther two is scheduled for launch shortly. All five satellites are designed assingle unit sized CubeSats, all actuated by magnetorquers and operating inLow Earth Orbit (LEO).

Satellite frame definition

Magnetorquers

Figure 1.1: Exploded view of the AAUSAT satellite

5

Page 16: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

6 Introduction

From figure 1.1 an exploded view of the AAUSAT3 and AAUSAT4 is shown.The exploded view of the satellite shows three magnetorquers placed mutuallyperpendicular to each other, aligning these perpendicular to the x-, y- or z-axisof the satellite body respectively.

Mission specifications

Throughout the report, mission specific parameters are needed to determinethe satellite behavior wrt. the environment. The parameters used in thisreport is based on the AAUSAT-3 structure and orbit, and, unless otherWisementioned, are as listed in appendix A.

1.2 Coordinate Systems

In order to describe the environment of the satellite, several different coordi-nate systems are used. Some coordinate systems origins at the Earth whileothers use the satellite itself. In the subsequent paragraphs the different coor-dinate systems used in this text is described. It should be noted, that everymentioned coordinate system are right hand orthogonal systems.

IX

IY

I,ECEFZ

ECEFX

ECEFY

CX

CY

CZ

SX

SY

SZ

OXOY

OZ

Satellite

Orbit path

Inertial frameECEF frameControl ref. frameSatellite body frameOrbit frame

Figure 1.2: The used coordinate systems shown relative to each other. The illustrationis not scalable.

Orbit CS

The Orbit coordinate system origins at the Satellites centre of mass with thez-axis pointing from the satellite towards the Earths centre of mass. The y-axis

Page 17: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

1.3. Rotations 7

points in the direction of the orbit velocity vector while the x-axis completesthe system.Frame superscript: O

Inertial CS

The Inertial coordinate system has its origin at the Earths centre of mass. Thez-axis is parallel to the Earths axis of rotation and points towards the NorthPole. The x-axis spans from the centre of Earth to Vernal Equinox1. They-axis completes the coordinate system.Frame superscript: I

ECEF CS

The Earth-centered Earth-fixed coordinate system has the origin at the Earthscentre of mass and shares the z-axis with the Inertial CS. The x- and y-axisaligns with the corresponding axes in the Inertial CS on the initial Julian date.After this, it follows Earth’s rotation.Frame superscript: ECEF

Satellite body CS

The Satellite body coordinate system is fixed in the satellite. The coordinatesystem originates at a corner of the physical satellite frame as defined on figure1.1. The z-axis is defined to be perpendicular to the antenna side of the body.The sensor measurements will be made in this frame.Frame superscript: S

Control reference CS

The Control coordinate system is used to simplify the inertia matrix later on.This coordinate system has the origin in the satellite centre of mass with itsprincipal axes fixed relative to the axes of the Satellite body CS. The x-axisis the axis with maximal moment of inertia and the z-axis is the one with thelowest moment of inertia.Frame superscript: C

1.3 Rotations

The project contains multiple coordinate systems, and rotations of measure-ments and attitude representations between the coordinate systems are needed.Methods of this is described below using rotation matrices and quaternions.

1Vernal Equinox is the point where the ecliptic crosses the equator on the first day ofspring.

Page 18: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

8 Introduction

Rotation matrices

The orientation of a vector (e.g. a measurement or heading) in a given coor-dinate system can be expressed in another coordinate system by the use of arotation matrix.

S z

Sy

Sx

C x

C y

C z

Control ref. CS

Satellite body CS

Figure 1.3: Coordinate system within a reference coordinate system.

The rotation between two coordinate systems, for instance from the Satellitebody frame to the Control ref. frame, as seen on figure 1.3, can be describedby the rotation matrix [[Wertz, 1994]]

CS A =

Cx[Sx]Cx[Sy]

Cx[Sz]Cy[Sx]

Cy[Sy]Cy[Sz]

Cz[Sx]Cs[Sy]

Cz[Sz]

(1.1)

where CiSj is the representation of Sj onto the Ci axis.A vector given in the Satellite body frame can by this approach be described

in the Control ref. frame by using the rotation matrix as

Cv = CS ASv (1.2)

The rotation matrix will in this report mostly be used to perform measurementoperations. This could for instance be gyroscope- or magnetometer measure-ments in the Satellite body frame that needs to be transformed into coordinatesof the Control ref. frame.The rotation matrix can also be used to perform operations on the attitude

representation of the satellite, but it has a serious disadvantage; the Eulerangles can represent the same orientation in multiple ways, leading to singu-larities. This can be avoided by using quaternions as described in the nextsection.

Page 19: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

1.3. Rotations 9

Quaternions

The quaternions provide a singularity-free describtion of the orientation withonly four parameters. The quaternion consists of three imaginary parts and asingle real part and can be expressed as [[Wertz, 1994]]

q = iq1 + jq2 + kq3 + q4 (1.3)

or with the imaginary part contracted as

q = q + q4 (1.4)

A unit quaternion can be rotated about the vector n = [n1 n2 n3]ᵀ at an

angle φ, by the equations:

q1 = n1 sinφ

2

q2 = n2 sinφ

2

q3 = n3 sinφ

2

q4 = cosφ

2(1.5)

The unit quaternion satisfies the constraint

qᵀq = qᵀq + q24 = q21 + q22 + q23 + q24 = 1 (1.6)

By this constraint it is seen that the quaternion representation of the rotationbetween two aligning frames is

baq = [q1 q2 q3 q4]

ᵀ = [0 0 0 1]ᵀ (1.7)

The quaternion rotation between coordinate systems are used extensivelythroughout the report. The quaternion representing the rotation from theSatellite body frame to the Control reference frame can be written as

CS q. (1.8)

A convenient feature of representing attitude by quaternions is the methodfor calculating succesive rotations. A rotation can for instance be calculatedas

21q =3

1 q⊗23 q (1.9)

or equivalently by

21q = S

(23q)

31q (1.10)

Page 20: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

10 Introduction

with S (q) being the skew-symmetric matrix

S (q) =

q4 q3 −q2 q1−q3 q4 q1 q2q2 −q1 q4 q3−q1 −q2 −q3 q4

(1.11)

The quaternion can be used for vector rotation as well. To do this, theimaginary part of the quaternion is used. This gives:

Cv = CS q∗ ⊗ Sv ⊗ C

S q (1.12)

with CS q∗ being the conjugate of C

S q and Sv is the 3-dimensional vector aug-mented like [vx vy vz 0]ᵀ.The rotation matrix from eq. (1.1) can be represented by quaternions as

CS A =

[C iS

CjSCkS

](1.13)

where e.g. kS is the z-axis of the Satellite body frame given in the Controlreference frame. By parameterizing by quaternions the vectors become:

C iS =[q21 − q22 − q23 + q24 2(q1q2 − q3q4) 2(q1q3 + q2q4)

]ᵀ (1.14)CjS =

[2(q1q2 + q3q4) −q21 + q22 − q23 + q24 2(q2q3 − q1q4)

]ᵀ (1.15)CkS =

[2(q1q3 − q2q4) 2(q2q3 + q1q4) −q21 − q22 + q23 + q24

]ᵀ (1.16)

This could for instance be used to calculate the angular velocity relationbetween multiple frames

SOΩ = S

I Ω− ωOSjO (1.17)

Page 21: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Part II

Modeling

11

Page 22: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 23: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Kinematic and DynamicModel 2

This chapter describes the modeling of the kinematics and dynamics of a rigidspacecraft. The equations contains inputs from actuators and disturbances, thesewill be presented in the next chapter.

2.1 Kinematic

The kinematic equation presented here is the motion of a rigid spacecraft,described as the rotation from an orientation at a time instance to anotherorientation shortly after. This is presented using unit quaternions. [Wertz[1994]]Let the orientation of the spacecraft at time t be given by the quaternion q(t).

The later orientation at time t+ ∆t can then be described as q(t+ ∆t). Therotation between q(t) and q(t + ∆t) can be expressed by another quaternionq:

q(t+ ∆t) = q q(t). (2.1)

With the definition of a quaternion from eq. (1.5) the relation can be rewrit-ten as:

q(t+ ∆t) =

[cos

∆φ

2E + sin

∆φ

2S (Ω)

]︸ ︷︷ ︸

q

q(t) (2.2)

with E being the identity matrix and S (n) being the skew symmetric repre-sentation of the vector of rotation, Ω.The angle of rotation, ∆φ, can for small rotations be approximated to be

Ω∆t. Together with the small angle approximations

• cos∆φ

2= 1

• sin∆φ

2=

Ω∆t

2

the rotation in eq. (2.2) simplifies to become

q(t+ ∆t) ≈[E +

1

2S (Ω) ∆t

]q(t) (2.3)

where S (Ω) is the skew symmetric representation of the angular velocity

S (Ω) =

0 ωz −ωy ωx

−ωz 0 ωx ωy

ωy −ωx 0 ωz

−ωx −ωy −ωz 0

(2.4)

13

Page 24: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

14 Kinematic and Dynamic Model

The rate of change of the orientation can now be found by using

q(t) =q(t+ ∆t)− q(t)

∆t(2.5)

and by replacing the first term in the numerator with the expression from eq.(2.3), the kinematic equation becomes

q(t) =1

2S(COΩ)q. (2.6)

or rewritten with the quaternion spilt into the imaginary and scalar part

q4 = −1

2COΩq (2.7)

˙q =1

2COΩq4 −

1

2COΩ× q (2.8)

2.2 Dynamic

The dynamic equation of the satellite describes how torques relates to the angu-lar velocity of the body. These torques could for instance be the control torques(magnetorquers, momentum wheels etc.) or disturbances (aerodynamic drag,gravitational forces etc.). [Wertz [1994]]

O

R

ρi

i

Rigid Body

Figure 2.1: ρi: Vector from COM to a given mass i. R: Vector from Fr to COM of Fs

The rigid body shown in figure 2.1 consists of n-mass points. From the centreof mass to the mass point i lies the vector ρi. The angular momentum for therigid body rotating in the Inertial frame can by Newton’s second law be definedas

L ≡n∑

i=1

miρi × ρi. (2.9)

Page 25: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

2.2. Dynamic 15

by rewriting ρi = Ω× ρi and inserting it into 2.9 it becomes

L =

n∑i=1

miρi × (Ω× ρi) (2.10)

At this point the inertia is introduced. By defining the inertia as

I11 ≡n∑

i=1

mi(ρ2i2 + ρ2i3) (2.11a)

I22 ≡n∑

i=1

mi(ρ2i3 + ρ2i1) (2.11b)

I33 ≡n∑

i=1

mi(ρ2i1 + ρ2i2) (2.11c)

I21 = I12 ≡ −n∑

i=1

miρi1ρi2 (2.11d)

I23 = I32 ≡ −n∑

i=1

miρi2ρi3 (2.11e)

I31 = I13 ≡ −n∑

i=1

miρi3ρi1 (2.11f)

with eq. (2.11a-2.11c) being the sum of intertia and eq (2.11d-2.11f) beingthe product of inertia, eq. (2.10) becomes

L ≡ IbCI Ω. (2.12)

By letting the principal axes of the satellite form the basis for the Controlframe CS, the off-diagonal elements of inertia matrix disapears, leaving onlythe sum of inertia on the diagonal. This is set up in matrix form as

Ip =

I11 0 00 I22 00 0 I33

From this, the time derivative of the angular momentum, which relates to

the torques acting on the satellite, can be set up as

L + CI Ω× L =Next (2.13)

L = −CI Ω× L+Next (2.14)

with Next being external torques.By rewriting eq. (2.12) to C

I Ω = I−1p L, eq. (2.14) becomes

L = −(I−1p L)× L + Next (2.15)

Page 26: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

16 Kinematic and Dynamic Model

or equivalently

IpCI Ω = −C

I Ω× (IpCI Ω) + Next

CI Ω = −I−1p

[CI Ω× (Ip

CI Ω)

]+ I−1p Next. (2.16)

The external torques, Next, is in this report set to be the input torque causedby the magnetorquers and the external torques caused by disturbances suchas gravity gradient, aerodynamic drag, radiation and magnetic dipole. Theselected torques are described in the next chapter.

Page 27: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Actuator and Disturbances 33.1 Magnetorquers

The satellite is controlled by six coils, mounted side by side as three pairs,placed mutually perpendicular to each other in the satellite body as seen onfigure 1.1. This makes them align with the x-, y- and z-axis of the Satellitebody frame respectively. When an electric current runs through these coils, amagnetic dipole moment is generated. This magnetic dipole moment can foreach of the coils be described as [Hughes [2004]]

m = niA (3.1)

where

• n is the windingcount of the coil

• i is the applied current

• A is the coil area.

The magnetic dipole moment from each of the coils can be combined in avector notation. This can be written as

Sm =

mx

my

mz

(3.2)

As this magnetic dipole moment from the magnetorquers is given in the Satel-lite body frame and is needed in the Control frame, a rotation is made

Cm = CS ASm. (3.3)

The magnetic dipole of the magnetorquers interacts with the magnetic fieldfrom Earth, resulting in a control torque described by

CNctrl = Cm× CB (3.4)

= Cm× COAOB (3.5)

where OB is magnetic flux vector of Earth given in the Orbit frame. Themaximal magnetic flux value from Earth can be approximated as

B =2M

r3(3.6)

where M is the magnetic moment of Earth and r is the distance from thecentre of Earth.The magnetorquers used in the AAUSAT project is dimentioned with the

following parameters

17

Page 28: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

18 Actuator and Disturbances

A Coil area 0.049[m2]

n Coil winding count 275 [−]i Electric current 53 [mA]r Distance to satellite 6978 [km]M Earth’s magnetic moment 7.96 · 1015 [T]

The magnetorquers, with the given parameters, can produce a torque of946.46 nNm.

3.2 Gravitational Torque

O’dmn

Bn

ρn

r

dms

Bs

Figure 3.1: r: Vector from COM to a given mass i. ρn: Vector from COM in Fr to mi

in Fs

The forces acting on a mass element in the satellite body caused by thegravitational gradient from Earth can be written as [Hughes [2004]]

dFi =−µRidmi

R3i

(3.7)

with

• Fi being the i’th gravitational force• µ being the gravitational constant from Earth• Ri being the orientation from Earth’s geocenter to the ith mass element.• Ri being the distance from the geocenter of Earth to the ith mass element

The torque acting on the satellite from the gravity gradient forces becomes

dNi = ri × dFi (3.8)

where ri is the vector from the centre of mass to the ith mass element withthe corresponding force Fi.

Page 29: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

3.2. Gravitational Torque 19

O

ρ

rir′i

Rs

Ri

Centre of mass

Geometric centre

Mass element, dmi

Figure 3.2: Gravity gradient torque description

The combined torque from all of the element masses can be combined as

Ng =

∫ri × dFi =

∫ (ρ+ r′i

)× −µRi

R3i

dmi (3.9)

with the terminology given in figure 3.2.Assuming that the geometric center is the centre of mass, the distance from

the Earth to the satellite is much greater than the size of the satellite and thatthe satellite consists of a single rigid body, eq. (3.9) becomes

Ng =3µ

R3s

[Rs ×

(IpRs

)](3.10)

The equation from eq. (3.10) can be rewritten to fit the coordinate systemsused in this report. The unit vector pointing from Earth to the satellite body,Rs is the same as the zenith vector local to the orbit position. This can befound in the transformation matrix from the Orbit frame to the Satellite bodyframe as described in eq. (1.13)

SOA =

[SiO

SjOSkO

](3.11)

with Sc3O being the projection of the Orbit frame z-axis onto the axes of theSatellite body frame. Inserting this notation into eq. (3.10), it becomes

Ng = 3ω2o

(SkO × Ip

SkO

)(3.12)

In order to find the worst case torque caused by gravity on the satellite, eachof the concerning parameters has been set equal to the worst possible values.The worst possible gravity gradient is defined to occur wwith the centre ofmass displaced 2 cm towards one of the corners of the satellite, see figure 3.3,

Page 30: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

20 Actuator and Disturbances

m1

m2

v2

v1

Geometric centre

Satellite body

Figure 3.3: COM displacement causing maximum gravity gradient

as this increases the possibility to locate the point mass further away from thecentre of mass.The displacement of the centre of mass gives rise to a torque around the ge-

ometric centre. By calculating the distance from centre of mass to the cornersand the corresponding masses, as seen on figure 3.3, the inertia matrix for theSatellite body frame can be recalculated according to eq. (2.11a - 2.11f).Denote the vector from centre of mass to the nearest corner of the satellite by

v1 and the opposite vector from the centre of mass to the far-off corner by v2,and the corresponding masses in these directions by m1 and m2 respectively.The new inertia matrix becomes

sI =

0.0041 −0.0024 −0.0024−0.0024 0.0041 −0.0024−0.0024 −0.0024 0.0041

(3.13)

with

v1 =

0.03850.03850.0385

v2 =

0.06150.06150.0615

m1 = 0.385 kg m2 = 0.615 kg | v1 | = 0.0666 m | v2 | = 0.1066 m

This results in a worst case gravity gradient torque of 23.98 nNm.

3.3 Aerodynamic Drag

The aerodynamic drag is caused by the surrounding atmosphere acting as aresisting force on the satellite body. The most important parameters are thearea of the body drifting through the wind, and the atmospheric density. The

Page 31: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

3.3. Aerodynamic Drag 21

maximal disturbing torque caused by drag, is found when the exposed areais at its maximum and the vector from the centre of pressure to the centreof mass is perpendicular to the velocity vector, see figure 3.4. The maximumarea is given as the attitude where a corner of the satellite is pointing in theorbit direction. The minimum area is given as the attitude where a side of thesatellite is pointing in the orbit direction, see figure 3.5

v

N

Satellite surface

Figure 3.4: Satellite surface cutting through the wind

Figure 3.5: Maximum and minimum surface area

The force created by the aerodynamic drag can be calculated by the formula[Hughes [2004]]

Faero = −1/2CDρv2(N · v

)vdA (3.14)

with

• CD, drag coefficient• ρ, air density• v, velocity

Page 32: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

22 Actuator and Disturbances

•(N · v

)v, angle between the normal vector of the exposed area and the

velocity vector• dA exposed area

In these calculations, the exposed area is calculated in the direction of thevelocity vector, which simplifies the formula. The resulting torque based onthis force is calculated as

Naero = Faero ×Rcom. (3.15)

With the following values

CD Drag coefficient 2 [−]ρ600 Air density at 600 km altitude 1.454 · 10−13

[kg/m3

]v Velocity 6000 [m/s]A Area 0.01733

[m2]

the worst case aerodynamic torque disturbance is calculated to be 22.54 nNmin an orbit height of 600 km. As the height decreases, the aerodynamic force,and thereby torque, increases.

3.4 Magnetic Residual Dipole

Placed in LEO, the satellite will interact with Earths magnetic field, and anymagnetic field created in the satellite by electric currents or material propertieswill thereby result in a force in a given direction. This magnetic field strengthand direction is very hard to determine prior to launching the satellite, whichis why a worst case estimate is used in the following.The satellite has been estimated as a magnetic dipole with a dipole moment

of 10 mAm2 based on [NASA [1969]]. Like magnetorquers, the torque producedby the magnetic residual dipole disturbance can be calculated as [Wertz [1994]]

Nmag = mmag ×B (3.16)

with mmag being the magnetic moment of the satellite and B being the mag-netic flux vector from Earth.The maximal magnetic flux value from Earth can be approximated as

B =2M

r3(3.17)

where M is the magnetic moment of Earth and r is the distance from thecentre of Earth.Using the values from the following table, the worst case disturbing magnetic

residual torque is calculated to be 468.54 nNm.

M Earth’s magnetic moment 7.96 · 1015 [T]r Distance from entre of Earth to satellite 6978 [km]D Satellite dipole moment (estimate) 10

[mAm2

]

Page 33: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

3.5. Solar Radiation 23

3.5 Solar Radiation

The light rays, mainly from the sun, that reaches the satellite will either beabsorbed or reflected. In both situations the light rays will cause a pressure onthe satellite body resulting in a torque around the centre of mass. The lightemission and reflection from Earth and the moon could also cause a pressureon the satellite, however, this radiation is small compared to that caused bythe sun.

N

Solar radiation, Frad Reflection

Satellite surface

Figure 3.6: Solar radiation and reflection on satellite surface

The pressure, Frad, on a radiated area is given as [Wertz [1994]]

Frad = CaPA (3.18)

where Ca is the absorption constant of the radiated area, P is the solar fluxand A is the radiated area. The radiation constant Ca is a number between 1(total absorption) and 2 (total reflection).The solar flux depends on the distance from the sun and is therefor near

independent of orbit altitude in LEO. The solar flux is calculated as

P =Fs

c= 4, 53 · 10−6 kg/ms2 (3.19)

with Fs being the mean solar energy, 1358 W/m2, and c being the speed oflight.The resulting torque around the centre of mass is the given as

Nrad = Frad ×RCOM (3.20)

where RCOM is the vector from the centre of mass to the geometric centre ofradiation pressure.The worst case torque caused by radiation can now be calculated to be

3.138 nNm, with

Page 34: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

24 Actuator and Disturbances

Ca Absorption constant 2 [−]P Solar flux 4.53 · 10−6

[kg/ms2]

A Maximum radiated area 0.01733[m2]

RCOM Distance from geometric center to COM 2 [cm]

3.6 Disturbance Comparison

The mentioned actuator- and disturbance torques are given in the followingtable

ActuatorNtorque Magnetorquers 946.46 [nNm]

DisturbancesNg Gravity gradient 23.98 [nNm]Naero Aerodynamic drag 19.26 [nNm]Nmag Magnetic residual dipole 468.54 [nNm]Nrad Solar radiation 3.14 [nNm]

Resulting torqueNresult Resulting torque 411.89 [nNm]

As seen, the most significant disturbance is by far the magnetic residualdipole, however, this is based on an estimate of the magnetic dipole momentof the satellite.

Page 35: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Earth’s Magnetic Field andControllability 4

Actuating the satellite by magnetorquers in Low Earth Orbit causes som challenges,as the satellite will not have full controllability.

4.1 Geomagnetic Field of Earth

The geomagnetic field surrounding Earth vary in field strength and directionaccording to the local position of the satellite in orbit. The magnetic field canbe compared to that of a dipole magnet where the dipoles are located at themagnetic poles of Earth.

Figure 4.1: Magnetic field around Earth as a dipole. Figure provided by WikimediaCommons

The magnetic field can be represented by the IGRF (International Geo-magnetic Reference Field) model, a model approximating the magnetic fieldstrength and direction at any location around Earth, taking the abnormali-ties from an ideal magnetic dipole field into account. An example of the fieldstrength approximated by the IGRF-11 model can be seen in figure 4.2.The magnetic field strength and direction will vary highly according to the

location of the satellite. In figure 4.3 an example of an orbiting satellite isseen.

25

Page 36: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

26 Earth’s Magnetic Field and Controllability

Figure 4.2: IGRF model showing field strength abnormalities [Wertz [1994]]

0 1 2 3 4 5 6 7 8 9

x 104

−5

−4

−3

−2

−1

0

1

2

3

4

5x 10

−9 Magnetic field in Orbit frame

Mag

netic

flux

[T]

Time [s]

BxByBz

Figure 4.3: Magnetic field experienced by satellite in LEO.

4.2 Controllability

The satellite will not experience controllability in all three axes at the sametime, as the torque produced by the magnetorquers can only be applied per-pendicular to the direction of the magnetic field. In other words, the torqueproduced in a three dimensional space by the magnetorquers will be projecteddown onto the two dimensional plane perpendicular to the local geomagneticfield as seen on figure 4.4.

Page 37: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

4.2. Controllability 27

Projected torque Desired torque

B-field

Figure 4.4: Desired torque projected down onto the plane perpendicular to the B-field

The torque produced by the magnetorquers is written as

Ndes = m×B (4.1)

where m is the magnetic dipole moment produced by the torquers [mx my mz]ᵀ

and B is the geomagnetic field from Earth [Bx By Bz]ᵀ.

The torque projected down onto the perpendicular plane can be written as[R. Wisniewski [1996]]

Nctrl =

[Ndes ×B

||CB||2

]︸ ︷︷ ︸

mprojected

×B (4.2)

If the desired torque is parallel to the local geomagnetic field, the resultingcontrol torque from eq. (4.2) becomes zero. If the desired torque is perpen-dicular to the local geomagnetic field, the resulting- and desired torque willremain the same.

Page 38: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 39: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Part III

Estimation and Control

29

Page 40: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 41: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Satellite Energy andLyapunov Stability 5

In order to prove stability for the controller in chapter 7, the Lyapunov conditionis investigated in the following chapter.

An initial Lyapunov candidate is set up based on the energy of the satellite.In the following section the energy of the system is investigated, and in thesubsequent sections a Lyapunov candidates for the controller is shown.

5.1 System Energy

The energy of the satellite is split into two; a kinetic energy caused by thesatellite rotating between the Inertial frame and Orbit frame, and a potentialenergy caused by the gravity gradient and the fact that the satellite rotatesaround Earth, named the gyro effect. [Hughes [2004]]

Kinetic Energy

The kinetic energy is a result of the satellite rotating in the Inertial frame. Theangular velocity of the satellite can be considered as a sum from the Inertialframe to the Orbit frame and the angular velocity from Orbit frame to theSatellite Reference frame. Expecting the angular velocity from the Inertialframe to the Orbit frame, ωo, to be constant1, the resulting expression for thekinetic energy becomes

Ekinetic =1

2COΩ

ᵀICOΩ (5.1)

Potential Energy

The potential energy is based on the effects of the gravity gradient and therotational motion of the satellite.The potential energy due to the gravity gradient can be written as

Egravity =3

2ω2oCkOIp

CkO (5.2)

where CkO is the local Zenith unit vector resolved in the Control Referenceframe.The rotational motion of the satellite also causes a potential energy. The

summand CI Ω× Ip

CI Ω in the dynamic model from eq. (2.16) can be rewritten

according to

CI Ω = C

OΩ + ωoCjO (5.3)

1For a circular orbit

31

Page 42: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

32 Satellite Energy and Lyapunov Stability

Only a single part of the rewritten expression contributes to the potentialenergy, making the potential energy due to the rotational motion become

Egyro = −1

2ω2oCjO

ᵀIp

CjO (5.4)

Combined Energy

The combined energy for the satellite orbiting Earth can be written as

Etotal = Ekinetic + Egravity + Egyro

=1

2COΩ

ᵀICOΩ +

3

2ω2oCkOIp

CkO −1

2ω2oCjO

ᵀIp

CjO (5.5)

5.2 Lyapunov Stability

The controller described in the following chapters can be proven stable bylooking at a Lyapunov candidate function (LCF). The LCF can tell if thecontroller is stable or asymptotically stable. It is necessary to point out thata LCF is only a sufficient condition for the controller to be stable; if theconditions for the LCF are not satisfied for a specific controller it does notmean that the controller is unstable.From Khalil [2002] the LCF can be defined as:

Let x = 0 be an equilibrium point for x = f(x) and D ⊂ Rn be a domaincontaining x = 0. Let V : D → R be a continuously differentiable functionsuch that

V (0) = 0 and V (x) > 0 in D − 0 (5.6)

V (x) ≤ 0 in D (5.7)

Then, x = 0 is stable. Moreover, if

V (x) < 0 in D − 0 (5.8)

then x = 0 is asymptotically stable.

Energy Based LCF

As the behavior of the Lyapunov candidate function is coinciding with thedesired properties of the energy of a stable system, an initial guess for a LCFto prove stability for a controller would be based on the energy expression fromeq. (5.5)

Page 43: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

5.2. Lyapunov Stability 33

V = Etotal

=1

2COΩ

ᵀICOΩ +

3

2ω2oCkOIp

CkO −1

2ω2oCjO

ᵀIp

CjO (5.9)

The derivative of the LCF can be written as

V = COΩ

ᵀICOΩ + 3ω2

oCkOIp

C jO − ω2oCjO

ᵀIp

C jO (5.10)

From the system dynamics, an expression for IpCOΩ can be obtained by using

eq. (5.3)

IpCOΩ = ω2

oIpC jO − S

[COΩ]Ip

COΩ + ω2

oS[COΩ]Ip

CjO + ω2oS[COΩ]Ip

COΩ

− ω2oS[CjO

]Ip

CjO + 3ω2oS[CkO

]Ip

CkO︸ ︷︷ ︸Ngg

+Nctrl (5.11)

The LCF derivative can be reduced by inserting eq. (5.11) into eq. (5.10)and use the following math operators

COΩ S

[COΩ]

= 0 (5.12)C jO = S

[CjO

]COΩ (5.13)

CI Ω = C

OΩ + ωoS[CjO

]COΩ (5.14)

The LCF derivative now becomes

V = COΩ

ᵀ[ω2oIp

C jO − S[COΩ]IpCOΩ + ω2

oS[COΩ]Ip

CjO + ω2oS[COΩ]Ip

COΩ −

ω2oS[CjO

]Ip

CjO + 3ω2oS[CkO

]Ip

CkO + Nctrl

]+ 3ω2

oCkOIp

C kO − ω2oCjO

ᵀIp

C jO

(5.15)

V = COΩ

ᵀNctrl (5.16)

It will later be shown that the energy based LCF can not be used to proveasymptotic stability for the Sliding Mode Controller in chapter 7, however itcan be used to prove other attitude controllers asymptotically stable. Anotherattempt to make a LCF is shown in the following section.

Additional LCF

To prove stability for the Sliding Mode Controller, another LCF is set up. Theenergy based LCF fails the condition of V (x) ≤ 0 for the SMC; a conditionwhich is belived possible to meet with another LCF. [R. Wisniewski [1996]]

Page 44: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

34 Satellite Energy and Lyapunov Stability

It will be shown in chapter 7 that a desirable LCF derivative could look like

V = qᵀCOΩ (5.17)

since this can be shown to be negative definite. From the kinematics, thederivative of the real part of the quaternion is

q4 = −1

2COΩ · q (5.18)

A LCF that supports this derivative can be written as

V = 2(1− q4) (5.19)

or equivalent, by the expression q ᵀ q + q24 = 1, as

V = qᵀq + (1− q4)2 (5.20)

Page 45: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Magnetic Dipole MomentEstimation 6

From chapter 2 it was shown, based on an estimate, that the magnetic dipolemoment of the satellite was the largest disturbance by far. In order for the attitudecontroller to counteract this magnetic dipole moment, an estimation is necessary.

From the disturbance comparison made earlier it was seen, that the magneticdipole moment of the satellite was by far the greatest. In order to make aprecise estimation of the magnetic dipole moment, a method using an ExtendedKalman Filter (EKF) is proposed in the following. [T. Inamori [2010]]

6.1 Estimation Method

The proposed method for estimating the magnetic dipole moment is based onaugmenting an Extended Kalman Filter (EKF) as it could be considered atraditional bias estimation. The dynamic model for the system relates the ex-ternal torques to the behavior of the satellite, as was described in section 2.2.By letting the satellite perform without input control in detumbled mode theonly torques acting on the satellite is the disturbances described in chapter 3.The estimation requires knowledge about the change in angular velocity mea-sured by the gyroscopes, and the magnetic field around the satellite measuredby the magnetometers.

6.2 Magnetic Dipole Estimation

The estimation of the magnetic dipole moment is made with an augmentedEKF. An EKF is chosen over a traditional (linear) Kalman filter, as this offersthe possibility to linearize the system at all time instances. As the magneticfield from Earth is part of the system equation, this is highly desired.The estimation consists of two parts; a prediction- and an update part. The

prediction step uses the previous state estimate together with the system modelto calculate a new state estimate. The update step uses the state predictiontogether with a measurement to create the resulting state estimate. For someapplications, multiple prediction steps may be performed per update step, orlikewise the other way around.The EKF is operating in discrete time where the system model is given as

xk = Φkxk−1 + Γkuk + Gkwk (6.1)zk = Hkxk + Dkuk + vk (6.2)

As mentioned earlier, the control input is set to zero in this application,

35

Page 46: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

36 Magnetic Dipole Moment Estimation

reducing eq. (6.1 - 6.2) to

xk = Φkxk−1 + Gkwk

zk = Hkxk + vk

Γ

Γ

Φ

Φ

z−1

z−1

H

H

K

u

zk

zk−+

x+kx−k

w v

Figure 6.1: Kalman filter

From figure 6.1 the structure of the Kalman Filter can be seen as a traditionalobserver. This leads to the following equations for the EKF predict- andupdate part [M. Grewal and A. Andrews [2008]]

Prediction

x−k = Φkx+k−1 (6.3)

zk = Hkx−k (6.4)

P−k = ΦkP+k−1Φ

ᵀk + Qk−1 (6.5)

Update

Kk = P−k Hᵀk

(HkP

−k Hᵀ

k + Rk

)−1 (6.6)x+k = x−k + Kk (z− z) (6.7)

P+k = (E−KkHk) P−k (6.8)

The dynamical model for the satellite is used in the EKF, as this relates theinput torques to the angular velocities as mentioned earlier. The dynamicalmodel has been given in eq. (2.16) as (with frames omitted)

Ip∆Ω = −Ω× (IpΩ) + m×B (6.9)

where all disturbances except the magnetic dipole moment has been neglected.The model is linearised according to

x = xref + ∆x. (6.10)

Page 47: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

6.2. Magnetic Dipole Estimation 37

where the system is to be linearised around xref . This makes the system modelbecome

∆Ω = I−1p (S[IpΩref ]− S[Ωref ]Ip)∆Ω− I−1p (S[B])∆m (6.11)

with S[·] being a skew symmetric representation.Since the EKF is augmented with the magnetic dipole moment, the state

vector can be described as

x =

[Ωm

]=

[Ωref 3×1mref 3×1

]+

[∆Ω3×1∆m3×1

](6.12)

with Ω = [ωx ωy ωz]ᵀ being the angular velocities and m = [mx my mz]

being the magnetic dipole moment given in the Satellite reference frame.The EKF uses the following dimensions and values for the calculations

A =

[I−1(S[IΩref ]− S[Ω]I) S[−I−1B]

03×3 03×3

](6.13)

B =[E6×6

](6.14)

H =[E3×3 03×3

](6.15)

Q =

[E3×3 03×303×3 10−3 ·E3×3

](6.16)

R = 10−1 ·[E3×3

](6.17)

The above dimensions and values have been used in simulations to test theEKF performance. In the following sections different situations are tested.

Estimation Results

Firstly the functionality of the EKF is verified by letting all the disturbances,except the satellite magnetic dipole, be set to zero and let the EKF estimatethe magnetic dipole moment. For the verification simulation the followingvalues have been used:

Maximum gravity gradient 0 NmMaximum aerodynamic drag 0 NmMaximum solar radiation 0 NmMagnetic residual dipole [0 0 − 0.006]ᵀ Am2

Orbit height 600 kmInitial angular velocity 10−3 · [1 1 1]ᵀ rad/sSimulation time 4 orbits

Page 48: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

38 Magnetic Dipole Moment Estimation

The wanted output from the EKF estimation would be the same as the setmagnetic dipole moment at the simulation. An average of the last 15,000seconds of the estimator output, as seen on figure 6.2, results in a satisfyingmagnetic dipole estimation of [0 0 − 0.0059]ᵀ Am2 .

0 0.5 1 1.5 2 2.5

x 104

−7

−6

−5

−4

−3

−2

−1

0

1x 10

−3 Magnetic dipole moment estimation

Mag

netic

fiel

d st

reng

th[A

m2 ]

Time[s]

m

x

my

mz

Figure 6.2: Satellite magnetic dipole estimation with EKF

Confident in the estimation results, the previously neglected disturbanceshave been reinserted into the simulation. The parameters for the Kalmanfilter has been kept the same as previously and the simulation parameters setto be the following:

Page 49: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

6.2. Magnetic Dipole Estimation 39

Maximum gravity gradient torque 23.89 nNmMaximum aerodynamic drag torque 19.26 nNmMaximum solar radiation torque 31.38 nNmMagnetic residual dipole [0.002 − 0.002 − 0.006]ᵀ Am2

Orbit height 600 kmInitial angular velocity 10−3 · [1 1 1]ᵀ rad/sSimulation time 4 orbits

From the results show in figure 6.3 the output average of the last 15,000 secondsresults in a magnetic dipole moment estimation of [0.0021 − 0.0018 − 0.0058]ᵀ

Am2.

0 0.5 1 1.5 2 2.5

x 104

−6

−5

−4

−3

−2

−1

0

1

2

3x 10

−3 Magnetic dipole moment estimation

Mag

netic

fiel

d st

reng

th[A

m2 ]

Time[s]

m

x

my

mz

Figure 6.3: Satellite magnetic dipole estimation with EKF

Page 50: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

40 Magnetic Dipole Moment Estimation

Implementation Considerations

The data used for the previously calculated estimate has been captured froma simulation tool, which provided the data with a perfect state knowledge. Inorder to use the EKF to estimate the magnetic dipole moment of an orbitingsatellite, some additional work needs to be made.

Sensor Bias

The sensors used to measure the magnetic field surrounding the satellite, mag-netometer, and the angular velocity, accelerometer, needs to be calibrated inorder for the measurements to be usefull. For both sensors this can be donewith a least square approximation.

Estimation with State Noise

The previous estimations are based on simulation data without any noise. Inthe following estimation, a white noise with the variance σ2 = 0.0001 has beenincluded at the equation in (6.1) as w and a noise with variance σ2 = 0.000012into eq. (6.2) at v, in order to represent the uncertainties in the measurements.These values are based on the results in [K. Vinther and K. Jensen [2010]].The parameters have been kept the same as in the previous simulation

Maximum gravity gradient torque 23.89 nNmMaximum aerodynamic drag torque 19.26 nNmMaximum solar radiation torque 31.38 nNmMagnetic residual dipole [0.002 − 0.002 − 0.006]ᵀ Am2

Orbit height 600 kmInitial angular velocity 10−3 · [1 1 1]ᵀ rad/sSimulation time 4 orbits

The resulting estimate from the EKF based on noisy data can be seen onfigure 6.4. The average of the last 10,000 seconds is calculated to be[0.0021 − 0.0017 − 0.0056]ᵀ Am2, which correspond to an estimation errorof 7.8 %.

Page 51: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

6.2. Magnetic Dipole Estimation 41

Figure 6.4: Satellite magnetic dipole estimation with EKF of noisy data.

Page 52: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 53: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Sliding Mode Controller 7A non-linear attitude controller is in the following presented, as it is believedto outperform traditional linear controllers.

7.1 Sliding Mode Introduction

A Sliding Mode Controller (SMC) is chosen as the attitude controller structurefor the project.A SMC works by acting on basis of the system states. The actuations is

divided into two parts, a reaching phase and a sliding phase. In the reachingphase the controller makes the system states reach a sliding manifold froman arbitrary state. The consecutive sliding phase makes the system statesconverge to an equilibrium by letting the states follow the sliding manifold,hence the name of the phase. These two phases can be seen in the phaseportrait on figure 7.1.

Reaching phaseSliding phase

Figure 7.1: Phase portrait of a converging SMC. Illustration from [http://ej.iop.org].

The sliding- and reaching phase is defined by a variable, the sliding manifold,denoted s. The manifold is designed to ensure convergence of the system statestowards an equilibrium. When the system is off the manifold, s 6= 0, it is saidto be in the reaching phase. When the system is on the manifold, s = 0, thesystem is said to be in the sliding phase.

Reaching phase

The purpose of the reaching phase is to force the states of the system towardsthe sliding manifold. This is done by applying a control gain according to theposition of the system states in proportion to the sliding variable.

43

Page 54: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

44 Sliding Mode Controller

Mathematical the reaching phase can be describes as [Bandyopadhyay [2006]]

lims→0+

s < 0 lims→0−

s > 0 (7.1)

or

ss < 0. (7.2)

To make sure the system states reaches the sliding manifold in finite time,the control gain is traditionally implemented as a sign-function. This makesthe controller act a bang-bang structure depending on the sign of s. This iswritten as

sign(s) =

1 s > 00 s = 0−1 s < 0

(7.3)

To reduce chattering at the manifold, the controller could actuate on thebasis of an alternative function, like the saturation function

sat(x) =

x |x| ≤ 10 x = 0

sign(x) |x| > 1(7.4)

where x represents the slopes

ε.

Sliding Phase

The reaching phase is preceded by the sliding phase. This is given as thephase, where the system dynamics has reached the sliding manifold and issliding along it towards the equilibrium. The sliding phase can be seen onfigure 7.1 where the chattering around the sliding manifold is visible. Thismagnitude and characteristics of this chatter is decided by the structure of thesliding variable, for instance by choosing the saturation function in eq. (7.4)instead of the sign function from eq. (7.3).Further more, the gain of the sliding variable determines how far away from

the sliding manifold the system states deviates and how well it suppressesdisturbances. [Khalil [2002]]

7.2 Sliding Manifold Design

The design of the SMC is divided into two, the sliding manifold and the slidingcondition. Firstly the manifold is designed and in the next section the slidingcondition is designed. [R. Wisniewski [1996]]

Page 55: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

7.2. Sliding Manifold Design 45

The sliding manifold has to be able to make the system converge. Theequilibrium for the system operating in Nadir mode is defined between theSatellite Body frame and the Orbit frame. The velocity between the framesmust be zero, S

OΩ = 0, and the quaternion orientation must keep the framesaligned S

Oq = [0 0 0 1]ᵀ. The deviation between the equilibrium and theactual states is defined as the errors, denoted Ω and q respectively.A Sliding Variable that makes the system converge can be set up as

s = Ω + Ksq (7.5)

where Ks is a positive gain constant. When the system is on the manifold,s = 0, the sliding variable can be rewritten as

Ω = −Ksq (7.6)

Convergence

The convergence towards the equilibrium can be proven by looking at theLuapunov Candidate Functions from chapter 5.

Energy Based LCF

The derivative of the LCF based on kinetic and potential energy from chapter5 became:

V = ΩNctrl (7.7)

which, by eq. (7.6), can be rewritten as

V = −KsqNctrl (7.8)

The control torque, Nctrl can not be guaranteed to be positive definite, whichis why the condition of a negative definite LCF derivative can not be fulfilledin order to achieve a asymptotically stable system. As the LCF is sufficientcriterions, this failed condition does not say anything about the stability of thesystem. Another LCF can therefor be tested to prove asymptotical stability.

Alternative LCF

The second attempt to create a LCF in chapter 5 is tested to guarantee asymp-totical stability. The LCF was given as

V = 2(1− q4) (7.9)

V = qᵀΩ = −qᵀKsq (7.10)

As Ks is a positive definite gain, the derivate is negative definite. The LCFtherefore satisfies the criterions from section 5.2 and can be considered to beasymptotical stable.

Page 56: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

46 Sliding Mode Controller

7.3 Sliding Condition Design

The sliding condition can be understood as the control gain needed for thesystem to reach the sliding manifold from an arbitrary point in the space ofthe sliding variable. To determine the sliding condition, the sliding variableis considered. The time derivative of the sliding variable can be considered asthe satellite motion on the space of the sliding variable

s = ˙COΩ + Ks

COq (7.11)

Eq. (7.11) can be rewritten by the dynamic and kinetic equations

Is = I ˙CI Ω + IKsq (7.12)

= −CI Ω× (ICI Ω)− ωoI(CjO × C

OΩ) + IKs

[COΩq4 + C

OΩq]

+ Ndist + Nctrl (7.13)

The terms in eq. (7.13) can be split into two. Terms describing the motion ofthe satellite and a term describing the control torque applied to the satellite.If the system is on the sliding manifold, the torque needed to keep the systemat the manifold can be described as the terms from eq. (7.13) regarding thesatellite motion. If the system is not on the sliding manifold, a torque is neededto force the system states towards it. This torque can be terms regarding thecontrol torque from eq. (7.13). Eq. (7.13) is therefore split into an equivalenttorque and a control torque

Is = −CI Ω× (ICI Ω)− ωoI(CjO × C

OΩ) + IKs

[COΩq4 + C

I Ωq]

+ Ndist︸ ︷︷ ︸Negative equivalent torque

+Nctrl︸ ︷︷ ︸Control torque

which corresponds to

Neq = CI Ω× (ICI Ω) +ωoI(CjO×C

OΩ)− IKs

[COΩq4 + C

I Ωq]−Ndist (7.14)

Sign-based Sliding Condition

The sliding condition used as the control torque can, according to [Bandy-opadhyay [2006]], be written as

Nctrl = −λsign(s). (7.15)

as it was stated in eq. (7.3). λ is a positive gain constant. This equation is onlytrue if the system is able to actuate the control torque in any direction. Thisis not the case for the satellite actuated by magnetorquers, as seen in chapter4, as the desired control torque is projected down on a two-dimensional planeperpendicular to the local magnetic field of Earth. The magnetic moment fromthis projection can be written as

Cm =NDesired Torque × CB

||CB||2(7.16)

Page 57: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

7.3. Sliding Condition Design 47

where the desired torque should be replaced by the sliding condition from eq.(7.15).

Cm =−λsign(s)

||CB||2× CB (7.17)

Inserting this expression for the magnetic moments into the equation for thedifferentiated sliding variable yields

s =

[−λI−1sign(s)

||CB||2× CB

]× CB (7.18)

=

[I−1(CB×−λsign(s)

)||CB||2

]× CB (7.19)

assuming Neq = 0.To check the stability of this sliding condition, it is tested with a Lyapunov

Candidate Function. The LCF used is

V =1

2sᵀIs (7.20)

Looking at the derivative of the LCF and inserting the expression from eq.(7.19) results in

V =−λ||CB||2

(CB× s

)(CB× sign(s)

)(7.21)

Equation (7.21) can not be guaranteed to be negative (semi)definite, as theangles between

(CB× s

)and

(CB× sign(s)

)might not have the same sign.

Continuous Sliding Condition

The sign-function from the previous mentioned sliding condition did not provestable. An alternative function is in the following presented. [R. Wisniewski[1996]]A continuous sliding variable is set up corresponding to the sign-based sliding

variable from eq. (7.15)

Ndes = Neq −λs︸︷︷︸Nctrl

(7.22)

Following the same procedure as previously, the magnetic moment of thecontrol torque can be written as

Cm =−λs

||CB||2× CB (7.23)

Page 58: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

48 Sliding Mode Controller

which gives a differentiated sliding variable looking like

s =

[−λI−1s

||CB||2× CB

]× CB (7.24)

once again assuming the equivalent torque to be zero.The derivative of the Lyapunov Candidate Function V = sᵀIs becomes

V =−λ||CB||2

(CB× s

)(CB× s

)(7.25)

The two last terms in eq. (7.25) retains the sign independent of the anglebetween CB and s. The conditions for the Lyapunov Candidate Function istherefore met and convergence towards the sliding manifold is secured.Results of the developed SMC is shown in the next chapter.

Page 59: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Part IV

Results and Conclusion

49

Page 60: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 61: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Simulation Results 8Simulation results of the Sliding Mode Controller from the previous chapter is inthe following

The controller performance is judged on the time to settle and stay withinan angular error of 10 degrees axis-wise, and at the same time use as littlepower (generated torque) as possible.

8.1 Sliding Mode Controller

The subsequent simulation of the Sliding Mode Controller has been conductedwithout any disturbances enabled, except state noise.The sliding variable is given as

s = Ω + Ksq (8.1)

and the derivative of the sliding variable as

s = I−1Nctrl (8.2)

where the control torque was decided by the sliding condition

Nctrl = −λs (8.3)

The parameters Ks and λ has been chosen by an empiric approach to be

• Ks = 0.0005

1 0 00 1 00 0 1

• λ = 0.00001.

The specific parameters regarding the simulation are listed in Appendix A.The simulation took 13.000 seconds, equivalent to just over two orbits, to

converge. The combined mean power consumption at steady state was 0.6 mW.The largest deviation from the angular reference after settling was 1.8 degrees.

51

Page 62: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

52 Simulation Results

0 1 2 3 4 5 6

x 104

−120

−100

−80

−60

−40

−20

0

20Angular error

Deg

rees

Time [sec]

Deg

x

Degy

Degz

0 1 2 3 4 5 6

x 104

−0.1

−0.08

−0.06

−0.04

−0.02

0

0.02Angular velocity error

[rad

/sec

]

Time [sec]

w

x

wy

wz

0 1 2 3 4 5 6

x 104

−6

−4

−2

0

2

4x 10

−9 Control torque

[Nm

]

Time [sec]

Torquer

x

Torquery

Torquerz

Figure 8.1: Simulation of Sliding Mode Controller.

8.2 Sliding Mode Controller with PerfectDisturbance Compensation

The subsequent simulation of the Sliding Mode Controller has been conductedwith the equivalent torque enabled. The sliding variable is given as

s = Ω + Ksq (8.4)

and the derivative of the sliding variable as

s = I−1Neq + I−1Nctrl (8.5)

Page 63: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

8.2. Sliding Mode Controller with Perfect Disturbance Compensation 53

where the control torque was decided by the sliding condition

Nctrl = −λs (8.6)

and the equivalent torque is known from eq. (7.14)

Neq = Ω× (IΩ) + ωoI(jo ×Ω)− IKs [Ωq4 −Ωq]−Ndist. (8.7)

The term Ndist inlcudes only the disturbance from the satellite magnetic dipolemoment, as this is considered the largest cf. section 3.6. The values of thesatellite dipole moment has been set to be mactual = [0.002 − 0.002 −0.006]ᵀ Am2. The controller was implemented with perfect knowledge of thesatellite dipole moment. This makes Ndist become

Ndist = mactual × CB (8.8)

The parameters Ks and λ has been chosen empirically as described in theprevious section, and has been kept the same

• Ks = 0.0005

1 0 00 1 00 0 1

• λ = 0.00001.

The specific parameters regarding the simulation are listed in Appendix A.This simulation is similar to the first simulation regarding convergence time.

It also settled in two orbits, however, the combined mean power consumptionat steady state increased to was 5 mW in order to generate a counteractingmagnetic dipole moment.

Page 64: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

54 Simulation Results

0 1 2 3 4 5 6

x 104

−120

−100

−80

−60

−40

−20

0

20Angular error

Deg

rees

Time [sec]

Deg

x

Degy

Degz

0 1 2 3 4 5 6

x 104

−0.1

−0.08

−0.06

−0.04

−0.02

0

0.02Angular velocity error

[rad

/sec

]

Time [sec]

w

x

wy

wz

0 1 2 3 4 5 6

x 104

−3

−2

−1

0

1

2

3x 10

−7 Control torque

[Nm

]

Time [sec]

Torquer

x

Torquery

Torquerz

Figure 8.2: Simulation of Sliding Mode Controller with perfect disturbance compensa-tion.

8.3 Sliding Mode Controller with EstimatedDisturbance Compensation

The subsequent simulation of the Sliding Mode Controller has been conductedwith the environmental disturbances enabled including the satellite dipole mo-ment.The Sliding Mode Controller has the same parameters as in the previous

section, except for Ndist. The enviromental disturbances from gravity gradient,solar radiation and aerodynamic pressure has been included, and the controllerdoes no longer know the real dipole moment of the satellite. This was estimated

Page 65: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

8.3. Sliding Mode Controller with Estimated Disturbance Compensation 55

in chapter 6 to be mest = [0.0021 − 0.0017 − 0.0056]ᵀ Am2.The simulation took 19.000 seconds to converge. The combined mean power

consumption at steady state was 6 mW.

0 1 2 3 4 5 6

x 104

−120

−100

−80

−60

−40

−20

0

20Angular error

Deg

rees

Time [sec]

Deg

x

Degy

Degz

0 1 2 3 4 5 6

x 104

−0.1

−0.08

−0.06

−0.04

−0.02

0

0.02Angular velocity error

[rad

/sec

]

Time [sec]

w

x

wy

wz

0 1 2 3 4 5 6

x 104

−3

−2

−1

0

1

2

3x 10

−7 Control torque

[Nm

]

Time [sec]

Torquer

x

Torquery

Torquerz

Figure 8.3: Simulation of Sliding Mode Controller with estimated disturbance compen-sation.

Page 66: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

56 Simulation Results

8.4 Sliding Mode Controller without DisturbanceCompensation

The subsequent simulation of the Sliding Mode Controller has been conductedwith all disturbances enabled, as in the previous section, but without theequivalent torque enabled.The Sliding Mode Controller has the same parameters as in the previous

section.The simulation did not converge to the demand of 10 degree axis-wise error.

Already at 11.000 seconds the error reaches 50 degrees and stays within thiserror throughout the simulation. The combined mean power consumption atsteady state was 7.5 mW.

Page 67: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

8.4. Sliding Mode Controller without Disturbance Compensation 57

0 1 2 3 4 5 6

x 104

−150

−100

−50

0

50

100Angular error

Deg

rees

Time [sec]

Deg

x

Degy

Degz

0 1 2 3 4 5 6

x 104

−0.15

−0.1

−0.05

0

0.05Angular velocity error

[rad

/sec

]

Time [sec]

w

x

wy

wz

0 1 2 3 4 5 6

x 104

−3

−2

−1

0

1

2

3x 10

−7 Control torque

[Nm

]

Time [sec]

Torquer

x

Torquery

Torquerz

Figure 8.4: Simulation of Sliding Mode Controller without disturbance compensation.

Page 68: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 69: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Conclusion and Discussion 9The developed Sliding Mode Controller performs as wanted. The simulationbased on ideal criterions, where all disturbances where known and counter-acted, had no trouble to converged to the nadir reference.The magnetic dipole estimation resulted in a fair estimate. The estimate

was performed on noisy states, where a real world implementation also wouldhave the challenge of bias errors at the sensors, which is believed to make thedipole estimate worse.When the estimated magnetic dipole moment is used in the sliding mode

controller to counteract the torque caused by the satellite dipole moment,the performance of the controller is highly dependent on the accuracy of theestimate, as was seen from chapter 8.If the results of the sliding mode controller is compared to that of the linear

quadratic controller from B, it is clear that the sliding mode controller outper-forms the linear quadratic controller.

The controller’s dependency on the accuracy of the satellite dipole momentestimate can be a challenge when implementing a controller on an orbitingsatellite, as even a small estimation error can cause an angular deviation fromthe reference attitude. Furthermore, the constant need to neutralize the dipolemoment also has a downside when looking at power consumption. Any furtherwork done to this project could be looking at a way to estimate the satellitedipole moment prior to launch, for instance as described in R. Moskowitzand R. Lynch [1964] where the estimation is based on measurements of themagnetic field around the satellite. If the dipole moment is known prior tolaunch it can be neutralized by inserting passive components, and therebyreduce the power consumption.

59

Page 70: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 71: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Part V

Appendix

Appendix content

• A Default Simulation Parameters

• B LQR Controller

• C Matlab Code

61

Page 72: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 73: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Simulation Parameters andOverview A

The simulation parameters for the controllers are stated in the table below.

SatelliteMass 1 [kg]Inertia diag[0.0017464, 0.0022092, 0.0022388] [−]Max area 0.01732

[m2]

Absorption constant 2 [−]Dipole moment [0.002 -0.002 -0.006]

[Am2

]Drag coefficient 2 [−]Centre of mass [0.04907 0.04891 0.04297] [m]Coil area 0.049

[m2]

Coil windings (pair) 550 [−]

EphemerisOrbit height 600 [km]Solar flux 4.53 · 10−6

[kg/ms2

]Earth’s magnetic moment 7.96 · 1015 [T]Velocity 6000 [m/s]Air density 1.454 · 10−13

[kg/m3

]An overview of the simulation can be seen on figure A.1

Ndisturbance

Ncontrol

Time

Initial values (t=0)

SatelliteDynamics

Orbit position

Angular velocity

Attitude

ControllerState

estimatorSensor

emulation

Figure A.1: Simplified simulation schematic

63

Page 74: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 75: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Linear Controller BTo compare the efficiency of the Sliding Mode Controller from chapter 7 a linearcontroller is made, based on the principle of a Linear Quadratic Regulator.This is intented to work as a Nadir pointing controller, tweaked to meet thefollowing points

Maximum peak power consumption 15 mWMaximum power consumption (1 orbit average) 10 mWMaximum individual axis deviation 10 deg.Maximum settle time 10 orbits

B.1 System model

The equations of motion from eq. (2.7) and eq. (2.16) are linearised to workin Nadir mode. The disturbances are neglected.The kinematic equation remains the same:

q =1

2R (Ω) s

rq. (B.1)

The external torques from eq. (2.16) gets replaced by the control torquefrom eq. (3.5)

IpΩ = −Ω× (IpΩ) + m(t)×B(t). (B.2)

B.2 Linearisation

The system model will have to be linearised about a desired operation pointin order to be used in a linear controller. This is described in the following.The attitude of the system is ment to perform in Nadir mode, which means

that a fixed vector spanned in the Satellite body frame will always point to-wards the centre of Earth. In this report the spanned vector will be parallelto the z-axis of the Satellite frame.When the z-axis of the satellite is pointing towards Earth and the x-axis is

pointing in the orbit direction, the frames of the body and the orbit is aligning.This can be expressed as S

OΩ = 0 = [0 0 0]ᵀ and SOq = [0 0 0 1]ᵀ.

Kinematic

The linearization of the kinematic equation is made from the Inertial frameto the Satellite body frame, which behaves as a negative rotation around they-axis: [0 − ωo 0].

65

Page 76: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

66 Linear Controller

YIXI

ZI

ZS

Figure B.1: Satellite orbiting the origin of the Inertial frame

With the kinematic equation from eq. (2.7) set up as

q1q2q3q4

=1

2R (Ω)

q1q2q3q4

(B.3)

[˙qq4

]=

1

2R (Ω)

[qq4

](B.4)

it can be rewritten as

˙q =1

2(q4Ω−Ω× q) (B.5)

q4 = −1

2Ωᵀq (B.6)

with q being the imaginary part of the quaternion,

q1q2q3

.When linearized as a negative rotation around the Satellite body y-axis, the

kinematic equation becomes

˙q =1

2Ωq4 −

1

2Ω× q ≈ 1

2Ω (B.7)

By replacing SI Ω with the expression for S

OΩCO the following equation resultsin the linearized version of the kinematics

δq =1

2δΩ− 1

2[0 − ωo 0]ᵀ − δq× [0 − ωo 0]ᵀ (B.8)

Page 77: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

B.3. State space model 67

Dynamic

The dynamic equation is also linearized as a negative rotation around theSatellite body y-axis. The dynamic equation consists of the cross couplingand the generated control torque

δΩ = δ (−Ω× IpΩ) + I−1p δNctrl (B.9)

The cross coupling becomes

−Ω× IpΩ =

(Iy − Iz)ωyωz

(Iz − Ix)ωzωx

(Ix − Iy)ωxωy

(B.10)

When linearized around the y-axis eq. (B.10) becomes

−Ω× IpΩ ≈

σxωoδωz

0σzωoδωx

(B.11)

with

σx =Iy − IzIx

σy =Iz − IxIy

σz =Ix − IyIz

(B.12)

B.3 State space model

Collecting the previously deduced linear models into a state space model yieldsthe following result

[Ω˙q

]=

0 0 ω0σx 0 0 00 0 0 0 0 0

ω0σz 0 0 0 0 012 0 0 0 0 ω0

0 12 0 0 0 0

0 0 12 ω0 0 0

[Ωq

](B.13)

B.4 Controller structure

When the satellite is operating in Nadir mode it corresponds to letting theSatellite body frame align with the Orbit frame. Any deviation from this isan error, denoted with the subscript e and can be expressed as

Ωe = SOΩ = SΩ− OΩ (B.14)

Page 78: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

68 Linear Controller

for the angular velocities, and as

qe = OS q = I

Sq⊗ OI q (B.15)

for the quaternion error.

Controller Satellite

ISq

ISΩ

qOI q

OI Ω

Figure B.2: Overview of the controller.

The system is linearized to work with an error of SOq = [0 0 0 1] and

SOΩ = [0 0 0]. The model and reference is given in the Inertial frame whilethe state errors are fed into the controller after the quaternion operation andangular velocity substraction, respectively. This can be seen on figure B.2.The controller is implemented as it would in a traditional MIMO system with

the system equation given as

x = Ax + Bu (B.16)

and full state observability and -feedback. The system states are estimated ina Kalman filter, performing calculations based on sensor reading and previousstates. As the resulting state estimate from the Kalman filter is differentfrom the true states, some precautions must be made. It is expected thatthe estimated states will act as an divergence around the true states. In thesimulations, the estimator noise around the true states will be approximatedas white noise with a mean of zero and a deviation of σ2 = 0.0001 for thequaternion states and a deviation of σ2 = 0.000012 for the angular velocitystates [K. Vinther and K. Jensen [2010]].

B.5 LQR

A Linear Quadratic Regulator (LQR) is used as the linear controller, in orderto compare it with a nonlinear controller. The LQR controller makes useof weighting matrices in order to calculate an optimal controller gain, whichmakes the system perform as desired.A LQR can be designed and implemented to work in online- or offline mode,

both having advantages and disadvantages compared to each other. The on-line LQR bases the controller gain on the present measurements, which shouldmake it point more accurately. The drawback is the need for solving the

Page 79: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

B.5. LQR 69

computationally heavy Riccati equation onboard the satellite. The offline con-troller applies a gain calculated prior to execution, based on the predictedsatellite environment. This gives a lower pointing accuracy compared to theonline controller but will be a lot easier to compute.It has been decided to carry on with the offline controller, from now on

refered to as a constant gain controller. The controller is inserted into thesystem equation from eq. (B.16), at the vector u. This can be described as

u = −Lxe (B.17)

The controller uses the magnetorquers as actuators, which means that thefeedback matrix, L, only inputs to the dynamic equation from eq. (2.16) as anexternal force, as described in section 3.1. The L matrix therefore looks like

L =

L11 L12 L13 L14 L15 L16

L21 L22 L23 L24 L25 L26

L31 L32 L33 L34 L35 L36

(B.18)

Performance function

The LQR optimizes a performance function to calculate the best possible con-troller gain for the system. The performance function uses penalties on thesystem states, input states and final states in order to deside how they per-form compared to each other. The discrete time version of the performancefunction, with equal penalties for the final states, is given as

I =N∑k=0

x(k)ᵀQ1x(k) + u(k)ᵀQ2u(k) (B.19)

with

• x(k) being the system states at time k• u(k) being the control signals at time k• Q1 being the penalty weights for the system states• Q2 being the penalty weights for the control signals

The resulting controller gain is calculated iteratively and requires knowledgeabout the orbit environment.

B-field approximation

The strength and direction of the magnetic flux field from Earth is dependingon the distance from Earth and the type of orbit, and is varying with time.This can be seen on figure B.3 From the figure it is possible to see, that the

Page 80: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

70 Linear Controller

Figure B.3: Magnetic field intensity of Earth [Wertz [1994]].

change in intensity of the magnetic field is highly dependent on the orbit. Anequatorial orbit would face less change in intensity, compared to a polar orbit.In order to use the magnetorquers in an offline linear controller, an average

of the magnetic field is nessesary. The average magnetic field can be calculatedas

oB =1

T

T∑t=1

oB(t) (B.20)

where oB(t) is the magnetic flux vector from Earth given in the orbit frame fortime t. The magnetic field has been captured from a simulation tool, set upwith the predicted orbit parameters. The magnetic field at the simulation toolis based on the IGRF11 model. An example of a magnetic field experiencedby the satellitte in polar orbit is shown in figure B.4

Weight penalty matrices

The weighting matrices, used in the performance function at eq. (B.19) tocalculate the optimal controller gain, is shown here. The matrices have beenset up with empirical guesses at first and iteratively adjusted in order to make

Page 81: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

B.5. LQR 71

0 1 2 3 4 5 6 7 8 9

x 104

−5

−4

−3

−2

−1

0

1

2

3

4

5x 10

−9 Magnetic field in Orbit frameM

agne

tic fl

ux [T

]

Time [s]

BxByBz

Figure B.4: Magnetic field captured in Orbit frame at polar orbit.

the system perform as described in the start of the chapter.

Q1 =

100 0 0 0 0 00 100 0 0 0 00 0 100 0 0 00 0 0 1 0 00 0 0 0 1 00 0 0 0 0 1

Q2 = 10−4

1 0 00 1 00 0 1

(B.21)

Simulation

The results from the simulation of the LQR are shown in the table below andin figure B.5. The simulation did not include any disturbances.

Power consumption:Settling phase (mean) 2,9 mW

Maintaining phase (mean) 0.724mWMean of 20 orbits 2mW

Maximum power consumption 12,2mWSettling time 19.500 sec

The settling time is defined to be the time it takes the satellite from an arbi-trary initial state till it settles with an axis-wise error below 10 degrees. Thepower consumption calculation is based on a simulation time of 20 orbits.

Page 82: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

72 Linear Controller

0 1 2 3 4 5 6 7 8 9 10

x 104

−2

−1

0

1

2

3

4x 10

−3

w1w2w3

0 1 2 3 4 5 6 7 8 9 10

x 104

−1

−0.5

0

0.5

1

q1q2q3

0 1 2 3 4 5 6 7 8 9 10

x 104

−2

0

2

4

6

8

10x 10

−5

in1in2in3

Figure B.5: Simulation of the system with chosen weights. Top: Angular velocity.Middle: Error angles. Bottom: Produced torque.

Page 83: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Matlab Code for SlidingMode Controller C

The following code is used as a function, with the following in- and outputs:

Input vector uu1:3 Magnetic field measurement [Bx By Bz] [Tesla]u4:7 Angular unit quaternion [q1 q2 q3 q4] [−]u8:10 Angular velocity [wx wy wz] [Rad/sec]

Output vectorout1:3 Control torque [Nctrlx Nctrly Nctrlz] [Nm]out4:7 Equivalent torque [Neqvx Neqvy Neqvz] [Nm]

MATLAB code:1 function out = smc_function(u)2 %#codegen34 % --------------------------------------------------%5 % - description -%6 % --------------------------------------------------%7 %Takes inputs from b-field , angle and ang. velocity.8 %Creates control torque and dutycycle for driver9

10 % --------------------------------------------------%11 % - inputs -%12 % --------------------------------------------------%13 B_b = u(1:3); %magnetic field [X Y Z] (Tesla)14 quat = u(4:7); %quaternion [q1 q2 q3 q(4/0)]15 omega_ob = u(8:10); %Angular velocity rate [Wx Wy Wz]161718 % --------------------------------------------------%19 % - noise -%20 % --------------------------------------------------%21 % Comment in to add state noise22 % noise = 0.001* randn (4,1);23 % quat = quat+noise;24 % quat = quat/norm(quat);25 %26 % noise = 0.00001* randn (3,1);27 % omega_ob = omega_ob +noise;2829 % --------------------------------------------------%30 % - Vars -%31 % --------------------------------------------------%32 % --- Environment ---33 orbitTime = 5830; % Orbit time in sec34 omega_0 = (2*pi)/orbitTime; % Orbit rate3536 % --- Space ship ---

73

Page 84: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

74 Matlab Code for Sliding Mode Controller

37 inertia = [0.0017464 ,0.0022092 ,0.0022388];38 I = diag(inertia);3940 % --- Torquers ---41 N = 550; % coil windings42 A = [0 0 0]; %init43 A(1) = 0.07*0.07; % coil area x44 A(2) = 0.07*0.07; % y45 A(3) = 0.07*0.07; % z46 V = 5; % supply voltage47 R_m = 950; % coil resistance48 i_max = [V/R_m , V/R_m , V/R_m]’; % max current49 m_max = [N*i_max (1)*A(1) , N*i_max (2)*A(2) , N*i_max (3)*A(3)]’; %

max dipole5051 % --- Initial state vector ---52 x0 = [quat ; omega_ob ]; % [q1 q2 q3 q0 Wx Wy Wz]5354 w_ob_x = x0(5); % Omega_x55 w_ob_y = x0(6); % Omega_y56 w_ob_z = x0(7); % Omega_z5758 omega_ob = [w_ob_x w_ob_y w_ob_z]’; %[Wx Wy Wz]59 q = [x0(4) x0(1) x0(2) x0(3)]’; %[q0 q1 q2 q3] !! switch q4 to q1

!!606162 q0 = q(1);63 q_bar = [q(2) q(3) q(4)]’;64 % The rotation matrix FROM body TO orbit65 S = [0 -q_bar (3) q_bar (2); q_bar (3) 0 -q_bar (1); -q_bar (2) q_bar

(1) 0];66 R_o_b = eye (3) + 2*q0*S + 2*(S);%^2;67 % The rotation matrix FROM orbit TO body68 R_b_o = R_o_b ’;697071 % Projection of the axes in the BODY frame72 i_b = R_b_o (:,1);73 j_b = R_b_o (:,2);74 k_b = R_b_o (:,3); % <=> c_b_3 = [R13 R23 R33]’75 % Gravitational torque76 tau_b_g = 3* omega_0 ^2*( cross(k_b , (I*k_b)));77787980 % --------------------------------------------%81 % - Controller -%82 % --------------------------------------------%83 %References84 q_r = [1 0 0 0]’;85 q4_r = q_r(1);86 q_bar_r = [q_r(2) q_r (3) q_r(4)]’;

Page 85: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Matlab Code for Sliding Mode Controller 75

87 Smatrix = [0 -q_bar_r (3) q_bar_r (2); q_bar_r (3) 0 -q_bar_r (1); -q_bar_r (2) q_bar_r (1) 0];

88 q_bar_tilde = (q4_r*q_bar) - (q0*q_bar_r) - (Smatrix*q_bar);89 %q_tilde = [eta_tilde ; epsilon_tilde ];9091 % Control gains92 %Ks = 0.0005* diag ([1 1 1]);93 Ks = 0.0005* diag ([1 1 1]);94 %lambda_s = 0.00001;95 lambda_s = 0.00001;9697 % Define sliding variable s and gain lambda_s98 s = omega_b_ob + Ks*q_bar_tilde;99

100 % Equivalent torques101 %tau_eqv = cross(omega_b_ib , I*omega_b_ib) - tau_b_g + omega_0*I*

cross(c_b_1 , omega_b_ob)...102 % - 0.5*I*Ks*( omega_b_ib*eta + cross(omega_b_ib ,epsilon));103 mag_dipole_estimate = [0.0021 -0.0017 -0.0056] ’;104 tau_eqv = -cross(B_b , mag_dipole_estimate);105106 %projected dipole107 f = 1/( norm(B_b)^2);108 tau_b_d = -lambda_s*s - tau_eqv; %desired torque109 m_b = f*cross(B_b ,tau_b_d);110111 % Magnetic torque.112 tau_b_m = cross(m_b ,B_b);113114 out = [tau_b_m ’ tau_eqv ’];

Page 86: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite
Page 87: Satellite Attitude Control - Aalborg Universitetprojekter.aau.dk/projekter/files/202321144/report.pdf · ysis of a nonlinear attitude control system for a CubeSat sized satellite

Bibliography

B. Bandyopadhyay. Discrete-time Sliding Mode Control. Springer, first edition,2006.

P. Hughes. Spacecraft attitude dynamics. Dover, first edition, 2004.

K. Vinther and K. Jensen. Attitude Determination and Control System forAAUSAT3, 2010.

H. Khalil. Nonlinear Systems. Prentice Hall, third edition, 2002.

M. Grewal and A. Andrews. Kalman Filtering. Wiley, third edition, 2008.

NASA. Spacecraft Magnetic Torques, 1969.

R. Moskowitz and R. Lynch. Magnetostatic measurement of spacecraft mag-netic dipole moment, 1964.

R. Wisniewski. Sattellite Attitude Control Using Only Electromagnetic Actua-tion, 1996.

T. Inamori. Magnetic dipole moment estimation and compensation for anaccurate attitude control in nano-satellite missions, 2010.

J. Wertz. Spacecraft attitude determination and control. Kluwer Academic,third edition, 1994.

77