+ All Categories
Home > Documents > Fredrik Optimal Control 2011 Prosjekt

Fredrik Optimal Control 2011 Prosjekt

Date post: 22-Dec-2015
Category:
Upload: gonzalo-rafael-landaeta-cordero
View: 5 times
Download: 1 times
Share this document with a friend
Description:
controlde actitud de de un doble cubesat usando magnetorquers
Popular Tags:
45
F INAL YEAR PROJECT Optimal attitude control of a double cubesat using magnetorquers Fredrik Sola Holberg Supervisor: Professor J.T. Gravdahl May 19, 2011
Transcript
Page 1: Fredrik Optimal Control 2011 Prosjekt

FINAL YEAR PROJECT

Optimal attitude control of a doublecubesat using magnetorquers

Fredrik Sola Holberg

Supervisor:Professor J.T. Gravdahl

May 19, 2011

Page 2: Fredrik Optimal Control 2011 Prosjekt

Abstract

As part of the Norwegian student satellite program ANSAT, the Norwegian universityof science and technology started their new student satellite project, NUTS - NTNUTest Satellite, in the fall of 2010. The goal of this project is to design and launch adouble cubesat satellite by the end of 2014. One of the project goals is the design andimplementation of efficient ADCS - attitude determination and control system for thesatellite.

Two energy based controllers and two different implementations of a linear quadraticcontroller have been investigated for this purpose, with regards to time and energyefficiency in preparation for further work with the ADCS system. In this report thedipole model of the Earth’s magnetic field have been used for simulation, while stillhaving a more accurate model in mind. All of the controllers are working to somedegree, but they are each best suited to different applications and use various amountsof power.

Page 3: Fredrik Optimal Control 2011 Prosjekt

Contents

I Theory 4

1 Introduction 51.1 NUTS - NTNU Test Satellite . . . . . . . . . . . . . . . . . . . . . . 5

1.2 Previous work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.3 Outline of the report . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Definitions and notations 72.1 Physical properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Reference frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2.1 ECI - Earth Centered Inertial frame . . . . . . . . . . . . . . 7

2.2.2 Body frame . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2.3 Orbit frame . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Attitude representation . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.1 Rotation matrix . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.2 Euler angles . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.3.3 Unit quaternions . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4 Inertia matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Mathematical modeling 113.1 Satellite model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.2 Torque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.2.1 Dipole model . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.2.2 Magnetic torque . . . . . . . . . . . . . . . . . . . . . . . . 12

3.2.3 Gravity gradient torque . . . . . . . . . . . . . . . . . . . . . 13

3.3 Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3.1 Rotation matrix . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3.2 Satellite model . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3.3 Torque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.3.4 State space . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2

Page 4: Fredrik Optimal Control 2011 Prosjekt

4 Energy & Stability 15

4.1 Energy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

4.1.1 Kinetic energy . . . . . . . . . . . . . . . . . . . . . . . . . 15

4.1.2 Potential energy . . . . . . . . . . . . . . . . . . . . . . . . 15

4.2 Lyapunov function . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

II Control 17

5 ADCS design 18

5.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.2 Determination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.3 Detumbling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.4 Stabilization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5.4.1 Energy based controllers . . . . . . . . . . . . . . . . . . . . 20

5.4.2 Optimal control . . . . . . . . . . . . . . . . . . . . . . . . . 20

6 Simulations 22

6.1 Simulation parameters . . . . . . . . . . . . . . . . . . . . . . . . . 22

6.2 Energy based controllers . . . . . . . . . . . . . . . . . . . . . . . . 22

6.2.1 Angular velocity feedback . . . . . . . . . . . . . . . . . . . 22

6.2.2 Attitude feedback . . . . . . . . . . . . . . . . . . . . . . . . 25

6.3 Optimal controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

6.3.1 Time varying system . . . . . . . . . . . . . . . . . . . . . . 29

6.3.2 Time invariant system . . . . . . . . . . . . . . . . . . . . . 32

6.4 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

III Conclusion 36

7 Concluding remarks 37

IV Appendix 39

A Matlab code 40

A.1 The initalization file . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

A.2 The controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

A.3 LQ gain matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

3

Page 5: Fredrik Optimal Control 2011 Prosjekt

Part I

Theory

4

Page 6: Fredrik Optimal Control 2011 Prosjekt

Chapter 1

Introduction

1.1 NUTS - NTNU Test Satellite

NUTS is the Norwegian university of science and technology’s contribution to theNorwegian student satellite program ANSAT. The program was initiated in 2007 asa continuation of the NCUBE-1 and NCUBE-2 projects. The goal of this program isto build and launch 3 cubesats by the end of 2014. In addition to the NUTS projectstudents from Narvik University College and the University of Oslo are building onesatellite each, HINCUBE and CUBESTAR respectively. NUTS is set to be the thirdand last satellite launched in this program. Some preliminary work on the project wasinitiated in the fall of 2010, and the first students began working on the project in thespring semester of 2011. Estimated launch date is late 2014. The satllite will be builtaccording to a double cubesat standard (10x10x20cm, 2.66kg) as the first double cube-sat effort from NTNU. The payload is yet to be determined, but some collaborationwith the department of physics is underway, with preliminary work being done on anIR-camera for atmospheric surveillance.

Updated information on the national program can be found at http://www.ansat.no andspecifics for NUTS are found at http://nuts.iet.ntnu.no/nano/.

1.2 Previous work

NAROM (Norwegian Centre for Space-related Education) had previously initiated twostudent satellite programs before the start of the current one ANSAT. The previoussatellites, NCUBE-1 and NCUBE-2 were collaborative efforts between the 3 schoolsinvolved in ANSAT in addition to the Norwegian university of life sciences. There isa solid body of work associated with these projects, but unfortunately they producedno real results as NCUBE-1 was lost along with the carrier rocket shortly after launch,and contact was never established with NCUBE-2. It follows that nothing final can besaid about the functioning of the adcs system developed for these two satellites, but thetheoretical work seems very sound and has been revisited and refined starting with athesis by Soglo in 1994[11].

5

Page 7: Fredrik Optimal Control 2011 Prosjekt

1.3 Outline of the report

Chapter 2 deals with the definitions and notations used throughout the report, as wellas some background material. Chapters 3 and 4 cover the mathematical descriptions ofthe system, before the different control strategies are outlined in chapter 5. Chapter 6contains the simulations of the various controllers as well as a discussion of the results.Finally chapter 7 is made up by some concluding remarks.

6

Page 8: Fredrik Optimal Control 2011 Prosjekt

Chapter 2

Definitions and notations

2.1 Physical properties

The physical properties of the satellite are given part by the cubesat standards and partby other students working on the NUTS project. The dimensions have been chosen asa double cubesat which has the measurements 10x10x20cm and a maximum allowedweight of 2.66kg. The actuators are chosen as three magnetic coils, also known asmagnetorquers for the time being, two of which with a cross-section area of 0.19m ·0.09m = 0.0171m2 and the third 0.09m ·0.09m = 0.0081m2. The number of windingsare 450 for the large coils and 800 for the small, inductor resistance 100Ω and thevoltage set at 5 volts. The axes are defined in figure 2.1. The preliminary orbit chosenhas an inclination of 98 and a height of 600km for our simulation purposes.

2.2 Reference frames

The satellite is represented in several different reference frames and the following aimsto give a short introduction to the frames used in this report.

2.2.1 ECI - Earth Centered Inertial frame

The ECI frame originates in the centre of the earth, with the x-axis pointing towards thevernal equinox, the z-axis along the Earth’s rotation axis at some initial time and they-axis completes the right-handed orthogonal system. [12] This frame is consideredan inertial frame where Newton’s laws of motion apply and will be represented by theletter i throughout this paper.

2.2.2 Body frame

The BODY frame is moving and rotating with the satellite. It’s origin lies with thecentre of mass of the satellite, the x-axis points in the forward direction, the z-axispoints down, and the y-axis completes the right-handed orthogonal system. This framewill be represented by the letter b throughout this paper.

7

Page 9: Fredrik Optimal Control 2011 Prosjekt

Figure 2.1: Satellite axes

2.2.3 Orbit frame

The origin of the orbit fram also lies with the satellie centre of mass, and it has thex-axis pointing along the positive velocity vector direction for circular orbits, the z-axis pointing towards the center of the Earth, and the y-axis comples the right-handedorthogonal system. This frame will be represented by the letter o throughout this paper.

2.3 Attitude representation

This section is meant to give a brief overview of different attitude representation andmethods to transform from one representation to another.

2.3.1 Rotation matrix

The coordinate transformation of a vector from frame b to frame a is given by

va = Rabvb (2.1)

whereRa

b = ~ai · ~b j (2.2)

is the rotation matrix from b to a as described in [3].

The rotation matrix is orthogonal and satisfies

Rba = (Ra

b)−1 = (Ra

b)T (2.3)

8

Page 10: Fredrik Optimal Control 2011 Prosjekt

The orthogonality property RT R = I can be used to find the time derivative of therotation matrix [3]:

Rab = ω

aab×Ra

b (2.4)

where ωaab is the angular velocity of frame b, relative to frame a, represented in frame a.

This report will mostly make use of the skew-symmetric cross product operator S(ω)to denote the cross product:

ω×= S(ω) =

0 −ωz ωyωz 0 −ωx−ωy ωx 0

, ω =

ωxωyωz

(2.5)

This notation can be found in a different, very useful parametrization of the rotationmatrix, the angle-axis parametrization which represents a rotation θ around the axis λ :

Rλ ,θ = I3x3 + sinθS(λ )+(1− cosθ)S2(λ ) (2.6)

2.3.2 Euler angles

A widely used set of parameters for the rotation matrix is the Euler angles, where thematrix is given as a composite rotation of selected combinations of rotations about thex, y and z-axes. The rotation matrix thus consists of three successive rotations givenby the roll-pitch-yaw angles.

Rab = Rz(ψ)Ry(θ)Rx(φ) (2.7)

This representation isn’t used in any calculations, it is merely used to find a morephysically relatable representation of the satellite’s attitude. The initial values are givenin Euler angles before being converted to a quaternion representation.

2.3.3 Unit quaternions

Unit quaternions or Euler parameters is a four-parameter method that arises as an al-ternative to the Euler angle representation. The rationale behind using quaternionsis to avoid representation singularities which may arise from calculations using Eulerangles. A quaternion q is a complex number consisting of a real part η and three imag-inary parts given by the vector ε . A rotation β around the λ -axis can be expressed onquaternion form

q =

η

ε1ε2ε3

=

[cos(β

2 )

λ sin(β

2 )

]0≤ β ≤ 2π (2.8)

this implies that the unit quaternion satisfy the constraint qT q = 1, in other words that

η2 + ε

21 + ε

22 + ε

23 = 1 (2.9)

9

Page 11: Fredrik Optimal Control 2011 Prosjekt

and the set Q of unit quaternions is

Q := q|qT q = 1,q = [η ,εT ]T , ε ∈ R3 and η ∈ R (2.10)

Using this and equation 2.6 a unit quaternion representation of the rotation matrix frombody to orbit frame is obtained

Rob(q) = I3×3 +2ηS(ε)+2S2(ε) (2.11)

where I3×3 is the identity matrix. For further calculations, it is helpful to view therotation matrix from orbit to body, which is the transpose of Ro

b, on the column vectorform

Rbo = (Ro

b)T = [cb

1 cb2 cb

3] (2.12)

where cbi are the projections of the xo−,yo− and zo−axes in the body frame.

2.4 Inertia matrix

For our satellite the principal axes of inertia coincides with the axes of the body frame,and the inertia matrix is reduced to

I =

Ix 0 00 Iy 00 0 Iz

(2.13)

where Ix, Iy and Iz are the moments of inertia about the xb−,yb− and zb−axes.

10

Page 12: Fredrik Optimal Control 2011 Prosjekt

Chapter 3

Mathematical modeling

3.1 Satellite model

By regarding the satellite as an ideal rigid body, a dynamic model of the satellite canbe derived from a Newton-Euler formulation as described in [5]

Iωbib +S(ωb

ib)Iωbib = τ

b (3.1)

where I is the satellite’s moment of inertia, ωbib the angular velocity of the body frame

relative the inertial frame and τb the torque acting on the satellite, all of which arerepresented in the body frame.

The satellite’s orientation in space is obtained through integration of the angular veloc-ity. A vector representation using unit quaternions is found in [7]

q =

ε

]=

12

[−εT

ηI3x3 +S(ε)

bob (3.2)

The angular velocity relations between the orbit, body and inertial frames are describedby the equation

ωbib = ω

bio +ω

bob = Rb

oωoio +ω

bob (3.3)

where ωoio = [0 ω0 0]T is the constant angular velocity of the orbit frame with respect

to the inertial frame.

3.2 Torque

In equation 3.1 the total torque acting on the satellite, τb, is introduced. This sectionexplores the two most significant contributions to that torque, the magnetic and gravi-tational torques.

11

Page 13: Fredrik Optimal Control 2011 Prosjekt

3.2.1 Dipole model

To model the magnetic torque on the satellite, a model of the earth’s magnetic fieldis needed. An accurate model which is the product of a collaborative effort betweenresearchers around the world, the International Geomagnetic Reference Field (IGRF),will probably be used in the controller design of the finalized satellite, but as far asthis report is concerned a first order dipole model will be adequate. The magnetic fieldis modeled as a dipole magnet at the earth’s center along an axis which intersects thesurface at the earth’s magnetic south pole. According to [6] a model that gives a goodestimate of the magnetic field is derived from a magnetic potential given by

φm =−µm

R2c

sinλm (3.4)

where µm = 7.9×1015 is the earth’s dipole constant, Rc is the distance from the satelliteto the center of the earth and λmthe latitude with regard to the magnetic equatorialplane. In [11] a series of operations and approximations is made, the most importantones being regarding the magnetic and geographical pole as one and assuming an orbitwhich passes directly over that pole to arrive at an expression for the magnetic flux inthe orbit frame:

Bo = B0

cosλm0

2sinλm

(3.5)

where B0 =µmR3

c= 2.3321× 10−5at a satellite altitude of 600km. The transformations

between the orbit and body frame is obtained by using the rotation matrix:

Bb = RboBo (3.6)

3.2.2 Magnetic torque

The magnetic coils in the satellite design can be used for attitude control by interac-tion with the Earth’s magnetic field, since they will produce a magnetic field of theirown when current flows through the windings. An apparant problem with this controlmethod is that it won’t be possible to set up an arbitrary torque, but that is dealt withby the controllers later on. The satellite will be built according to a double cubesatstandard, which means the cross-section of two of the coils will cover an area twice thesize of the cross-section of the third coil, and the total torque due to the coils is givenin [11] as

τbm = mb×Bb (3.7)

where mbis the total dipole moment generated by the inductors:

mb = mbx +mb

y +mbz =

NxAxixNyAyiyNzAziz

(3.8)

where N is the number of windings, A the cross section area and i the current throughthe respective inductors.

12

Page 14: Fredrik Optimal Control 2011 Prosjekt

3.2.3 Gravity gradient torque

The gravity gradient affects a non symmetric object in the Earth’s gravity field, and isregarded as a disturbance torque which can not be controlled. According to [13] thegravity gradient is given as

τg =3µ

R3c

ue× (Iue) (3.9)

where µ = 3.987×1014 is the Earth’s gravitational coefficient, I the inertia matrix, Rcis again the distance between the satellite and the center of the Earth and ue is the unitvector toward nadir. Using the third column vector of Rb

o, c3 and the diagonal inertiamatrix I, as in [11] the gravitational torque is then simplified to:

τbg = 3ω

20

(i33− i22)c23c33(i11− i33)c33c13(i22− i11)c13c23

(3.10)

where ω20 = µ

R3c.

3.3 Linearization

In order to apply a linear optimal controller on the system, the satellite equations needsto be linearized. The linearization will be used in a controller for stabilization closeto the reference, so the system is linearized around the equilibrium point η = 1,ε =0,ωb

ob = 0 and Rob = 1.

3.3.1 Rotation matrix

When the rotation matrix between the body and orbit frame from equation 2.11 islinearized it results in:

Rob = I3x3 +2S(ε) (3.11)

If this is transposed and expanded, the linearized rotation matrix from orbit to bodyensues

Rbo = 2

12 ε3 −ε2−ε3

12 ε1

ε2 −ε112

=

c11 c12 c13c21 c22 c23c31 c32 c33

(3.12)

3.3.2 Satellite model

Linearizing q from equation 3.2 around the reference point results in the linearizedsystem

q =

ε

]=

[0

12 ωb

ob

],ωb

ob = 2ε (3.13)

for the satellite’s orientation. Further, the angular velocity, equation 3.3, is linearizedas

ωbib =

2ε1−2ω0ε32ε2 +ω0

2 ˙ε3 +2ω0ε1

(3.14)

13

Page 15: Fredrik Optimal Control 2011 Prosjekt

and the time derivative of ωbib

ωbib =

2ε1−2ω0ε32ε2

2ε3−2ω0ε1

(3.15)

3.3.3 Torque

The gravitational torque, from equation 3.10 is by using equation 3.12 linearized as

τbg = 6ω

20

(Iz− Iy)ε1(Iz− Ix)ε2

0

(3.16)

The magnetic torque can be linearized as τbm = S(mb)Bo, which results in

τbm =

Boz my

Boxmz−Bo

z mx−Bo

xmy

(3.17)

3.3.4 State space

By introducing the state and torque vectors x and u

x = [ε1 ε ε2 ε2 ε3 ε3]T (3.18)

u = [mx my mz]T (3.19)

the entire system given by equation 3.1, can be written on state space form

x(t) = Ax(t)+B(t)u(t) (3.20)

where A and B(t) are given as

A =

0 1 0 0 0 0

−4kxω20 0 0 0 0 (1− kx)ω0

0 0 0 1 0 00 0 −3kyω2

0 0 0 00 0 0 0 0 10 −(1− kz)ω0 0 0 −kzω

20 0

(3.21)

B(t) =

0 0 00 1

2IxBo

z − 12Ix

Boy

0 0 01

2IyBo

z 0 12Iy

Box

0 0 01

2IzBo

y1

2IzBo

x 0

(3.22)

andkx =

Iy−IzIx

ky =Ix−Iz

Iy

kz =Iy−Ix

Iz

(3.23)

For a more detailed view of the linearization process, see e.g. [10] or [11].

14

Page 16: Fredrik Optimal Control 2011 Prosjekt

Chapter 4

Energy & Stability

4.1 Energy

The energy of the satellite is made up by kinetic and potential components. The kineticenergy mainly stems from rotation in the inertial and orbital frame and potential energyfrom the gravity gradient and gyro effects from the revolutions around the earth. Thefollowing expressions are based on [11, 14]

4.1.1 Kinetic energy

Assuming a near circular orbit gives an expression for the kinetic energy in the bodyframe with respect to the orbit frame

Ekin =12(ωb

ob)T Iω

bob (4.1)

4.1.2 Potential energy

The potential energy due to the gravity gradient and and revolution about the earth arerespectively

Egg =32

ω20 ((c

b3)

T Icb3− Iz (4.2)

Egyro =12

ω20 (Ix− (cb

1)T Icb

1 (4.3)

4.2 Lyapunov function

A commonly used Lyaunov function candidate is the energy function

V = Etot = Ekin +Egg +Egyro (4.4)

=12(ωb

ob)T Iω

bob +

32

ω20 ((c

b3)

T Icb3− Iz)+

12

ω20 (Ix− (cb

1)T Icb

1) (4.5)

15

Page 17: Fredrik Optimal Control 2011 Prosjekt

which satisfies

V (0) = 0 (4.6)V (x) < 0∀x 6= 0 (4.7)

is positive definite, proven in [10], and has the four equilibria for V (0)

(ωbob,c

b1,c

b3) : (0,±co

1,±co3) (4.8)

Further, the time derivative of V is, also shown in [10]

V = (ωbob)

bm (4.9)

16

Page 18: Fredrik Optimal Control 2011 Prosjekt

Part II

Control

17

Page 19: Fredrik Optimal Control 2011 Prosjekt

Chapter 5

ADCS design

5.1 Requirements

Efficient implementation of ADCS is a separately defined goal of the NUTS project,so as far as this report is concerned stabilization of the satellite is the defined controlobjective. Further work should have more clearly defined goals, such as being ableto point a camera towards the earth and possibly rotating the satellite about an axisto keep an even temperature distribution over the solar panels. Information from thepower management section of the project suggests 0.1watts of continuous power isavailable for the ADCS system.

5.2 Determination

Attitude determination is the subject of a master’s thesis being written by other mem-bers of the NUTS team, using a new approach to the QUEST method. This reportassumes the determination problem solved by other parts of the system, and that themeasurements will be readily available.

5.3 Detumbling

Before the stabilization phase is initiated, the satellite goes through a detumbling phase.The goal of the detumbling phase is to dissipate the kinetic energy of the satellite, asimple and widely used controller for detumbling is the control law

mb =−kBb−mc , where mc = [0 0 mc]T (5.1)

which has been proven effective using Lypaunov theory by e.g. Wisniewski [14].Again, another member of our team has implemented the detumbling controller us-ing the IGRF model, and simulation results are available, see figures 5.1 and 5.2

18

Page 20: Fredrik Optimal Control 2011 Prosjekt

Figure 5.1: Angular velocity of the body frame with regards to the inertial frame afterdetumbling

Figure 5.2: Attitude of the body frame after detumbling

19

Page 21: Fredrik Optimal Control 2011 Prosjekt

5.4 Stabilization

The main focus of this report lies with optimal control, but an energy based controllershould probably be used after the detumbling phase to bring the attitude closer to thereference before an optimal controller takes over.

5.4.1 Energy based controllers

Various energy based controllers have been investigated extensively in previous reportswritten for the NCUBE-1 and NCUBE-2 projects, a short summary of two differentand widely used approaches will be given here.

Angular velocity feedback

Also known as the Wisniewski controller, the control law is given by

mb = hωbob×Bb (5.2)

The controller can be shown to be stable about the equilibria

(ωbob,c

b3,c

b1) : (0,±co

3,±co1) (5.3)

by insertion into equation 4.9:

V = (ωbob)

T (Hωbob×Bb×Bb) (5.4)

as done in [4].

Attitude feedback

The angular velocity feedback controller doesn’t give any control about the z-axis, soa different controller which incorporates an attitude feedback term is suggested. Thiscontrol law is given by

mb = hωbob×Bb−αε×Bb (5.5)

which is stable about(ωb

ob,cb3,c

b1) : (0,co

3,co1) (5.6)

also proven in [4], by method of linearization about the reference.

5.4.2 Optimal control

A common controller investigated for satellites with magnetorquers is the linear quadraticcontroller. LQ controllers are known to be reliable and robust about the reference. TheLQ controller will here be applied to the linearized system from section 3.3:

x(t) = Ax(t)+B(t)u(t) (5.7)

with the A and B(t) matrices found in equations 3.21 and 3.22.

20

Page 22: Fredrik Optimal Control 2011 Prosjekt

The LQ problem minimizes a quadratic cost function, which here will penalize thedeviation from the reference attitude as well as actuator usage subject to weightingmatrices:

J(u) =12

ˆ T

t0[xT Qx+uT Pu]dt (5.8)

where x is the deviation from the reference attitude which in this case is zero, u isactuator usage and Q,P positive semidefinite weighting matrices. The system is knownto fulfill the controllability condition, and so the solution to the LQ problem is foundby solving the continuous Riccati equation

R(t) =−R(t)A−AT R(t)+R(t)B(t)P−1BT (t)R(t)−Q (5.9)

which gives the control law

u(t) =−P−1B(t)T R(t)x(t) (5.10)

This is said to be a very computationally demanding controller, as the matrix R(t) hasto be computed for each time step. A solution to this has been suggested, namelyto compute R(t) off-line and store it in a look-up table. However, that problem andsolution dates back to 1989 [9] and computational power might have improved enoughby now that this isn’t nescessary and as such merits a closer look further down the lineof the NUTS project.

A different solution is to take advantage of the near periodicity of the geomagneticfield and use the mean value of Bo to make the system time invariant. The system fromequation 5.7 is then reduced to

x = Ax+Bu (5.11)

and the Ricatti equation will only have to be solved once to give the control law

u(t) =−P−1BT Rx(t) (5.12)

The near periodicity concerns the IGRF model of the Earth’s magnetic field, as thedipole model of course is perfectly periodic and the results in this report will reflectthat.

This leaves the weighting matrices to be chosen, they are the tuning parameters of thecontroller, and so they are subject to a bit of trial and error, but as a rough starting point,Soglo[11] suggests using diagonal matrices with elements

qii =1

(∆xi)2 and pii =1

(∆ui)2 (5.13)

where ∆xi and ∆ui are viewed as nominally acceptable deviations in the state and actu-ator use respectively.

21

Page 23: Fredrik Optimal Control 2011 Prosjekt

Chapter 6

Simulations

6.1 Simulation parameters

Parameter Value

Weight 2.66 kgSize 0.1x0.1x0.2 mMoments of inertia Ix = 0.0111, Iy = 0.0111, Iz = 0.0044 kgm2

Coil windings Nx = 450, Ny = 450, Nz = 800Coil voltage 5 VCoil resistance 100Ω

Maximum coil current 0.05 A

Orbit height 600 000 mOrbit inclination 98

6.2 Energy based controllers

These controllers are mainly used when the deviation from reference is large, whereeither the angular velocity, the euler angles or both are far from the reference, zero.The initial values are partly based on the results from the detumbling controller and arechosen as

ωbob = [0.001, 0.006, −0.004] (6.1)

[φ , θ , ψ] = [50, 30 −40] (6.2)

6.2.1 Angular velocity feedback

The controller used is found in equation 5.2:

mb = hωbob×Bb (6.3)

22

Page 24: Fredrik Optimal Control 2011 Prosjekt

with h = 2.5×105 as the tuning parameter. Figure 6.1 shows that the controller slowsthe angular velocity and reduces the energy in the system, but it can’t control all threeEuler angles to zero, as expected. From figure 6.2 it can be seen that the peak powerusage is well within the power usage requirements. Also interesting is the total powerconsumed by this controller, which can be seen in figure 6.3 to be roughly 0.75W over10 orbits.

Figure 6.1: Angular velocity feedback controlled variables

23

Page 25: Fredrik Optimal Control 2011 Prosjekt

Figure 6.2: Angular velocity feedback actuator and power usage

24

Page 26: Fredrik Optimal Control 2011 Prosjekt

Figure 6.3: Angular velocity feedback total power consumed

6.2.2 Attitude feedback

The controller used is found in equation 5.5:

mb = hωbob×Bb−αε×Bb (6.4)

with h = 2.5× 105 and α = 150 as tuning parameters. This controller both slowsthe angular velocity and brings all the Euler angles to zero while reducing the totalenergy in the system, as seen in figure 6.4. The peak power usage is again well withinour constraints and is quite similar to the results from the angular velocity feedbackcontroller, shown in figures 6.5 and 6.6

25

Page 27: Fredrik Optimal Control 2011 Prosjekt

Figure 6.4: Attitude feedback controlled variables

26

Page 28: Fredrik Optimal Control 2011 Prosjekt

Figure 6.5: Attitude feedback actuator and power usage

27

Page 29: Fredrik Optimal Control 2011 Prosjekt

Figure 6.6: Attitude feedback total power consumption

28

Page 30: Fredrik Optimal Control 2011 Prosjekt

6.3 Optimal controllers

The optimal controllers are used on the system linearized around the equilibrium, whenthe deviations from reference are small. Hence the inital values are chosen as

ωbob = [0.0001, 0.0006, −0.0003] (6.5)

[φ , θ , ψ] = [5, −9, 4] (6.6)

around 110 of the inital values chosen for the energy based controllers.

A problem arises in the calculation of the gain matrix when the dipole model of theEarth’s magnetic field is used. As discussed by Busterud[2], setting the y componentof Bo as zero in equation 3.5 further leads to several additional zero components in thematrix B from equation 3.22. This B matrix is used to compute the LQ gain matrix andmight lead to singularities in the controller. In further work, the dipole model will bereplaced by the more accurate IGRF model, and the problem solves itself, but as faras the simulations in this report is concerned a small periodic perturbation was simplyadded to the By component. The dipole model is by itself not accurate enough that thisshould have any serious implications regarding the accuracy of the simulations.

6.3.1 Time varying system

First the supposedly very computationally demanding time varying controller is inves-tigated, found in equation 5.10 as

u(t) =−P−1B(t)T R(t)x(t) (6.7)

where the weighting matrices used in the Riccati equation are chosen by tuning as

Q = diag[1 0 1 0 1 0]1

( 60π

180 )2

and P = diag[1 1 1]1

(0.01)2 (6.8)

Starting as far back as 1994[11], q is usually not weighted, as simulation results haveshown that it doesn’t make any difference either way.

This controller quickly reaches the reference attitude, as seen in figure 6.7, but whatmakes this controller really stand out is the power consumption. Looking at figures 6.8and 6.9, this controller reduces the power consumption at least by a factor of ten com-pared to the other controllers, not compensated for the smaller initial values comparedto the energy based controllers.

29

Page 31: Fredrik Optimal Control 2011 Prosjekt

Figure 6.7: Time varying LQR controlled variables

30

Page 32: Fredrik Optimal Control 2011 Prosjekt

Figure 6.8: Time varying LQR actuator and power usage

31

Page 33: Fredrik Optimal Control 2011 Prosjekt

Figure 6.9: Time varying LQR total power consumption

6.3.2 Time invariant system

Found in equation 5.12

u(t) =−P−1BT Rx(t) (6.9)

with weighting matrices

Q = diag[1 0 1 0 1 0]1

( 10π

180 )2

and P = diag[1 1 1]1

(0.01)2 (6.10)

this controller works satisfactory, and quickly as well, as seen in figure 6.10. However,it is easily becomes unstable with varying initial conditions and the weighting matricesare very sensitive to small changes. It is a fairly good controller within the scopeof this report, but the conditions can be seen as somewhat ideal and unrealistic, likeusing the average values of a dipole model for the magnetic field for this controller,B = [9.8757× 10−8 5.0828× 10−12 1.1407× 10−6]. In addition it uses quite a lot ofpower compared to the time varying controller, shown in figures 6.11 and 6.12

32

Page 34: Fredrik Optimal Control 2011 Prosjekt

Figure 6.10: Time invariant LQR controlled variables

33

Page 35: Fredrik Optimal Control 2011 Prosjekt

Figure 6.11: Time invariant LQR actuator and power usage

34

Page 36: Fredrik Optimal Control 2011 Prosjekt

Figure 6.12: Time invariant LQR total power consumption

6.4 Discussion

All the controllers explored seems to reach their objectives, but the safest and mostrobust choice seems to be combining the angular velocity feedback controller for theinitial satellite stabilization with the time varying LQ controller for keeping it stable.Both the attitude feedback controller and the time invariant LQ controller definitelyhave their advantages, but the attitude feedback controller was quite hard to tune, andI suspect it won’t respond well to a wider range of initial conditions. While the gainmatrix calculations for the time invariant LQ controller is a lot faster than for the timevarying controller, it remains open whether this is a factor that should be emphasizedor not. For now I will place more weight on the wider range of initial conditions andtuning parameters supported by the time varying controller combined with the supremepower saving possibilities.

This is in tune with the conclusion of previous comparable reports, and shows that thedouble cubesat, not unexpectedly, shares a lot of properties with the standard singlecubesat attitude control wise.

35

Page 37: Fredrik Optimal Control 2011 Prosjekt

Part III

Conclusion

36

Page 38: Fredrik Optimal Control 2011 Prosjekt

Chapter 7

Concluding remarks

In this project work different controllers for the ADCS system of the NUTS projecthave been investigated and compared.

Both energy based controllers and optimal controllers show satisfactory results for dif-ferent control cases, and the best choice depends on whether or not hardware con-straints come into play. All of the controllers stay within the power budget of 0.1Wmaximum power use, but the time varying LQ controller singles out as the one with thelowest power consumption. Given that computation power is adequate, a combinationof an angular velocity feedback controller and a time varying LQ controller should bechosen for the stabilization phase of the ADCS system, given the choice between thewidely used controllers investigated in this report.

Further work on the satellite project regarding optimal control could include checkingwhether the hardware really places constraints on the use of time varying LQ controlleror not. Another interesting prospect to investigate further could be using an MPC con-troller for the attitude control. A different approach alltogether could be the inclusionof different kinds of actuators and various forms of passive stabilization.

37

Page 39: Fredrik Optimal Control 2011 Prosjekt

Bibliography

[1] Gaute Bråthen. Nonlinear attitude control of a double cubesat using magnetor-quers. 2011.

[2] B.E. Busterud. Orienteringsregulering av mikrosatellitter.

[3] O. Egeland and J.T. Gravdahl. Modeling and simulation for automatic control.2002.

[4] K.M. Fauske. Ncube attitude control. Project report. Department of EngineeringCybernetics, NTNU, 2002.

[5] K.M. Fauske. Attitude Stabilization of an Underactuated Rigid Spacecraft. Siv-ing theis, Department of Engineering and Cybernetics, Norwegian University ofTechnology and Science, pages 27–30, 2003.

[6] P.C. Hughes and P. Carlisle. Spacecraft attitude dynamics. J. Wiley, 1986.

[7] T.R. Kane, P.W. Likins, and D.A. Levinson. Spacecraft dynamics, volume 1. NewYork, McGraw-Hill Book Co, 1983.

[8] S.V. Marshall and G.G. Skitek. Electromagnetic concepts and applications, vol-ume 10. Prentice-Hall, 1990.

[9] K. MUSSER and W. EBERT. Autonomous spacecraft attitude control using mag-netic torquing only. In NASA, Goddard Space Flight Center, Flight Mechan-ics/Estimation Theory Symposium, 1989 p 23-38(SEE N 90-13413 05-13), 1989.

[10] E.J. Øverby. Attitude control for the norwegian student satellite ncube. Norwe-gian University of Science and Technology. Department of Engineering Cyber-netics, 2004.

[11] PK Soglo. 3-aksestyring av gravitasjonsstabilisert satellitt ved bruk av magnet-spoler. Siv. Ing Thesis, Department of Engineering Cybernetics, NTNU (Norwe-gian), 1994.

[12] B. Vik. Integrated Satellite and Inertial Navigation Systems. Department of En-gineering Cybernetics, NTNU, 2009.

[13] J.R. Wertz and W.J. Larson. Space mission analysis and design. 1999.

[14] R. Wisniewski. Satellite attitude control using only electromagnetic actuation.Department of Control Engineering, Aalborg University, 1996.

38

Page 40: Fredrik Optimal Control 2011 Prosjekt

Part IV

Appendix

39

Page 41: Fredrik Optimal Control 2011 Prosjekt

Appendix A

Matlab code

A.1 The initalization file

Common initialization file for all controllers

%**************************************************************************%Common initialization file for all controllers%%Written by Fredrik Sola Holberg, with help from Gaute Braathen and Zdenko%Tudor.%Ntnu, Trondheim, May 18th 2011.%%**************************************************************************

clc, clear all, clear global, close all;

global I B_0 omega_0 lambda_0 N A omega_o_io orbitTime omega_b_ob B_b m_b;global tau_m tau_g i_max B V e_0 K;

%Parametersmy = 6.67428e-11*5.9737e24; % Earth gravitational coefficient [m^3/s^2]my_f = 7.9e15; % Magnetic dipole coefficient, [Wb/m]B_0 = my_f/r^3; %Magnetic field constantR_0 = 6371000; % Mean earth radius, [m]r = R_0 + 600000; % Orbit radiusomega_0 = sqrt(my/R_0^3); % Angular velocity constant orbit w.r.t. inertialomega_o_io = [0 -omega_0 0]’; % Angular velocity of orbit w.r.t. inertialorbitTime = (2*pi)/omega_0; % Approx orbit time

m = 2.66; % Satellite mass, [kg]x = 0.1; % Length x-direction, [m]y = 0.1; % Length y-direction, [m]z = 0.2; % Length z-direction, [m]

40

Page 42: Fredrik Optimal Control 2011 Prosjekt

I_x = (1/12)*m*(y^2 + z^2); % Moment of inertia around the x-axis, [kg*m^2]I_y = (1/12)*m*(x^2 + z^2); % Moment of inertia around the y-axis, [kg*m^2]I_z = (1/12)*m*(x^2 + y^2); % Moment of inertia around the z-axis, [kg*m^2]I = diag([I_x I_y I_z]); % Satellite moment of inertia matrix, 3x3invI = inv(I); % The inverse of the satellite moment of inertia matrix, 3x3

N(1) = 450; % Number of windings, N_x[N]N(2) = 450; % Number of windings, N_y[N]N(3) = 800; % Number of windings, N_z[N]V = 5; % Voltage on coilsR = 100; % Resistance coilsi_max(1) = V/R; % Coil current, i_x[A]i_max(2) = V/R; % Coil current, i_y[A]i_max(3) = V/R; % Coil current, i_z[A]A(1) = 0.0171; % Coil area, A_x[m^2]A(2) = 0.0171; % Coil area, A_y[m^2]A(3) = 0.0081; % Coil area, A_z[m^2]

%Initial conditionsinit_phi = 5*(2*pi/360); % Initial phi, [rad]init_theta = -9*(2*pi/360); % Initial theta, [rad]init_psi = 4*(2*pi/360); % Initial psi, [rad]init_euler = [init_phi init_theta init_psi]; % Initial euler angles, [rad]init_quat = euler2q(init_phi, init_theta, init_psi); % Initial quaternionsinit_omega_b_ib = [0.0001 0.0006 -0.0003]’; %Init ang vellambda_0 = 0; %starting position in orbit

%Time invariant LQR gain matrix calculationB = [9.8757e-008 5.0828e-012 1.1407e-006]’; %Avg of mag. dipole strengthK = K2(B); %Gain matrix

%Initialization of the ode45 solvert_end = 10*orbitTime; % Simulation timeinit_x = [init_quat; init_omega_b_ib; lambda_0]; %initial ODE

options = odeset(’OutputFcn’, @odeout, ’MaxStep’, 50, ’Refine’, 1);[t,x] = ode45(@regfun,[0 t_end],init_x,options);

%storing values for plotting etc.omega_b_ib = [x(:,5), x(:,6), x(:,7)];

for i=1:size(x,1)q(i,1:4) = quatnormalize(x(i,1:4));[euler(i,1), euler(i,2), euler(i,3)] = q2euler(q(i,1:4));

end

41

Page 43: Fredrik Optimal Control 2011 Prosjekt

A.2 The controllers

This file contains all the controllers, with the time invariant LQ controller active, therest commented out

function x_dot = regfun(t,x0)%**************************************************************************%Common initialization file for all controllers%%Written by Fredrik Sola Holberg, with help from Gaute Braathen and Zdenko%Tudor.%Ntnu, Trondheim, May 18th 2011.%%**************************************************************************

global omega_o_io omega_0 B_0 N A I omega_b_ob B_b B m_b tau_m tau_g i_max;global V P;

%Extract and calculate values from inputq = [x0(1) x0(2) x0(3) x0(4)]’;q = quatnormalize(q’)’; %Normalized quaternioneta = q(1); %Separated quaternion, etaeps = [q(2) q(3) q(4)]’; %Separated quaternion, epsilonomega_b_ib = [x0(5) x0(6) x0(7)]’; %Angular velocity body relative inertiallambda = x0(8); %"Position" of the satellite

% Compute the quaternion rotation matrixR_o_b = eye(3) + 2*eta*Smtrx(eps) + 2*(Smtrx(eps))^2;%body to orbitR_b_o = R_o_b’; % ...from orbit to body

omega_b_ob = omega_b_ib - R_b_o*omega_o_io; %Ang velocity body rel orbit

%Compute q-doteta_dot = -0.5*(eps’)*omega_b_ob;eps_dot = 0.5*(eta*eye(3)+Smtrx(eps))*omega_b_ob;q_dot = [eta_dot; eps_dot];

%Magnetic field% B = B_0*[cos(lambda) 0.05*sin(lambda) 2*sin(lambda)]’; %Time-varying LQ% B = B_0*[cos(lambda) 0 2*sin(lambda)]’; %Energy based

B_b = R_b_o*B; %Magnetic field in body frame

%Torque from gravitytau_g = 3*omega_0^2*cross(R_b_o(:,3), I*R_b_o(:,3));

42

Page 44: Fredrik Optimal Control 2011 Prosjekt

%*************************************************************************% CONTROLLERS%*************************************************************************

%None% m_b = [0 0 0]’;

%LQ% K = K2(B); %Time varying LQm_b = K*[eps(1) eps_dot(1) eps(2) eps_dot(2) eps(3) eps_dot(3)]’;

% Angular velocity feedback% h = 2.5e+5;% m_b = h*cross(omega_b_ob, B_b);

%Attitude velocity feedback% h_r = 2.5e+5;% e_r = 150;% m_b = h_r*cross(omega_b_ob, B_b) - e_r*cross(eps, B_b);

% Current scaling [from Zdenko Tudor]for l=1:3

i(l) = m_b(l)/(N(l)*A(l));ratio(l) = i_max(l)/abs(i(l));

endif min(ratio)<1

m_b = m_b*min(ratio);end

% Power consumptioni(1) = abs(m_b(1)/(N(1)*A(1)));i(2) = abs(m_b(2)/(N(2)*A(2)));i(3) = abs(m_b(3)/(N(3)*A(3)));P = V*(i(1)+i(2)+i(3));

%Magnetic torquetau_m = cross(m_b, B_b);

%Update

omega_b_ib_dot = I\(-cross(omega_b_ib, (I*omega_b_ib)) + tau_g + tau_m);

x_dot = [q_dot; omega_b_ib_dot; omega_0];

end

43

Page 45: Fredrik Optimal Control 2011 Prosjekt

A.3 LQ gain matrix

This file contains the calculations made for the LQ gain matrix

function K = K2(B)%**************************************************************************%LQ gain matrix calculation%%Written by Eli Overby 2004, modified by Fredrik Sola Holberg.%Ntnu, Trondheim, May 18th 2011.%%**************************************************************************global I omega_0% Initial valuesIx = I(1,1);Iy = I(2,2);Iz = I(3,3);kx = (Iy - Iz)/Ix;ky = (Ix - Iz)/Iy;kz = (Iy - Ix)/Iz;

% The geomagnetic fieldBx_0 = B(1);By_0 = B(2);Bz_0 = B(3);

% The linearized system matrixA = [0 1 0 0 0 0 ;-4*kx*omega_0^2 0 0 0 0 (1 - kx)*omega_0;0 0 0 1 0 0;0 0 -3*ky*omega_0^2 0 0 0;0 0 0 0 0 1;0 -(1 - kz)*omega_0 0 0 -kz*omega_0^2 0];

% The input matrix for the linearized systemB = [0 0 0;0 Bz_0/(2*Ix) -By_0/(2*Ix);0 0 0;-Bz_0/(2*Iy) 0 Bx_0/(2*Iy);0 0 0;By_0/(2*Iz) -Bx_0/(2*Iz) 0 ];

% LQ-weighting matricesQ = diag([1 0 1 0 1 0])*1/((10*pi/180)^2); %xP = diag([1 1 1])*1/((0.01)^2); %u

% Calculate the gain matrixK = -lqr(A,B,Q,P);end

44


Recommended