Sei sulla pagina 1di 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

Abstract
As part of the Norwegian student satellite program ANSAT, the Norwegian university
of science and technology started their new student satellite project, NUTS - NTNU
Test Satellite, in the fall of 2010. The goal of this project is to design and launch a
double cubesat satellite by the end of 2014. One of the project goals is the design and
implementation of efficient ADCS - attitude determination and control system for the
satellite.
Two energy based controllers and two different implementations of a linear quadratic
controller have been investigated for this purpose, with regards to time and energy
efficiency in preparation for further work with the ADCS system. In this report the
dipole model of the Earths magnetic field have been used for simulation, while still
having a more accurate model in mind. All of the controllers are working to some
degree, but they are each best suited to different applications and use various amounts
of power.

Contents
I

Theory

Introduction

1.1

NUTS - NTNU Test Satellite . . . . . . . . . . . . . . . . . . . . . .

1.2

Previous work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3

Outline of the report . . . . . . . . . . . . . . . . . . . . . . . . . . .

Definitions and notations

2.1

Physical properties . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.2

Reference frames . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.2.1

ECI - Earth Centered Inertial frame . . . . . . . . . . . . . .

2.2.2

Body frame . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.2.3

Orbit frame . . . . . . . . . . . . . . . . . . . . . . . . . . .

Attitude representation . . . . . . . . . . . . . . . . . . . . . . . . .

2.3.1

Rotation matrix . . . . . . . . . . . . . . . . . . . . . . . . .

2.3.2

Euler angles . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.3.3

Unit quaternions . . . . . . . . . . . . . . . . . . . . . . . .

Inertia matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

2.3

2.4
3

Mathematical modeling

11

3.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

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

3.3

Energy & Stability

15

4.1

Energy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.1.1

Kinetic energy . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.1.2

Potential energy . . . . . . . . . . . . . . . . . . . . . . . .

15

Lyapunov function . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.2

II

Control

17

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

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

Optimal controllers . . . . . . . . . . . . . . . . . . . . . . . . . . .

29

6.3.1

Time varying system . . . . . . . . . . . . . . . . . . . . . .

29

6.3.2

Time invariant system . . . . . . . . . . . . . . . . . . . . .

32

Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35

6.3

6.4

III
7

IV

Conclusion

36

Concluding remarks

37

Appendix

39

A Matlab code

40

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

40

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

42

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

44

Part I

Theory

Chapter 1

Introduction
1.1

NUTS - NTNU Test Satellite

NUTS is the Norwegian university of science and technologys contribution to the


Norwegian student satellite program ANSAT. The program was initiated in 2007 as
a continuation of the NCUBE-1 and NCUBE-2 projects. The goal of this program is
to build and launch 3 cubesats by the end of 2014. In addition to the NUTS project
students from Narvik University College and the University of Oslo are building one
satellite each, HINCUBE and CUBESTAR respectively. NUTS is set to be the third
and last satellite launched in this program. Some preliminary work on the project was
initiated in the fall of 2010, and the first students began working on the project in the
spring semester of 2011. Estimated launch date is late 2014. The satllite will be built
according to a double cubesat standard (10x10x20cm, 2.66kg) as the first double cubesat effort from NTNU. The payload is yet to be determined, but some collaboration
with the department of physics is underway, with preliminary work being done on an
IR-camera for atmospheric surveillance.
Updated information on the national program can be found at http://www.ansat.no and
specifics 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 two
student satellite programs before the start of the current one ANSAT. The previous
satellites, NCUBE-1 and NCUBE-2 were collaborative efforts between the 3 schools
involved in ANSAT in addition to the Norwegian university of life sciences. There is
a solid body of work associated with these projects, but unfortunately they produced
no 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 be
said about the functioning of the adcs system developed for these two satellites, but the
theoretical work seems very sound and has been revisited and refined starting with a
thesis by Soglo in 1994[11].
5

1.3

Outline of the report

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

Chapter 2

Definitions and notations


2.1

Physical properties

The physical properties of the satellite are given part by the cubesat standards and part
by other students working on the NUTS project. The dimensions have been chosen as
a double cubesat which has the measurements 10x10x20cm and a maximum allowed
weight of 2.66kg. The actuators are chosen as three magnetic coils, also known as
magnetorquers 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 windings
are 450 for the large coils and 800 for the small, inductor resistance 100 and the
voltage set at 5 volts. The axes are defined in figure 2.1. The preliminary orbit chosen
has 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 aims
to 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 the
vernal equinox, the z-axis along the Earths rotation axis at some initial time and the
y-axis completes the right-handed orthogonal system. [12] This frame is considered
an inertial frame where Newtons laws of motion apply and will be represented by the
letter i throughout this paper.

2.2.2

Body frame

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

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 the
x-axis pointing along the positive velocity vector direction for circular orbits, the zaxis pointing towards the center of the Earth, and the y-axis comples the right-handed
orthogonal 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 and
methods 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 = Rab vb

(2.1)

Rab = {~ai b~ j }

(2.2)

where
is the rotation matrix from b to a as described in [3].
The rotation matrix is orthogonal and satisfies
Rba = (Rab )1 = (Rab )T
8

(2.3)

The orthogonality property RT R = I can be used to find the time derivative of the
rotation matrix [3]:
a
R b = aab Rab
(2.4)
a is the angular velocity of frame b, relative to frame a, represented in frame a.
where ab
This report will mostly make use of the skew-symmetric cross product operator S()
to denote the cross product:

0
z y
x
0
x , = y
= S() = z
(2.5)
y x
0
z

This notation can be found in a different, very useful parametrization of the rotation
matrix, the angle-axis parametrization which represents a rotation around the axis :
R , = I 3x3 + sin S( ) + (1 cos )S2 ( )

2.3.2

(2.6)

Euler angles

A widely used set of parameters for the rotation matrix is the Euler angles, where the
matrix is given as a composite rotation of selected combinations of rotations about the
x, y and z-axes. The rotation matrix thus consists of three successive rotations given
by the roll-pitch-yaw angles.
Rab = Rz ()Ry ( )Rx ( )

(2.7)

This representation isnt used in any calculations, it is merely used to find a more
physically relatable representation of the satellites attitude. The initial values are given
in 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 alternative to the Euler angle representation. The rationale behind using quaternions
is to avoid representation singularities which may arise from calculations using Euler
angles. A quaternion q is a complex number consisting of a real part and three imaginary parts given by the vector . A rotation around the -axis can be expressed on
quaternion form

#
"

1
)
cos(
2

q=
2 = sin( ) 0 2
2
3

(2.8)

this implies that the unit quaternion satisfy the constraint qT q = 1, in other words that
2 + 12 + 22 + 32 = 1
9

(2.9)

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 from
body to orbit frame is obtained
Rob (q) = I 33 + 2S() + 2S2 ()

(2.11)

where I 33 is the identity matrix. For further calculations, it is helpful to view the
rotation matrix from orbit to body, which is the transpose of Rob , on the column vector
form
(2.12)
Rbo = (Rob )T = [cb1 cb2 cb3 ]
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

Ix 0 0
I = 0 Iy 0
(2.13)
0 0 Iz
where Ix , Iy and Iz are the moments of inertia about the xb , yb and zb axes.

10

Chapter 3

Mathematical modeling
3.1

Satellite model

By regarding the satellite as an ideal rigid body, a dynamic model of the satellite can
be derived from a Newton-Euler formulation as described in [5]
I bib + S( bib )I bib = b

(3.1)

where I is the satellites 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 are
represented in the body frame.
The satellites orientation in space is obtained through integration of the angular velocity. A vector representation using unit quaternions is found in [7]

q =

1
=
2

T
I 3x3 + S()

bob

(3.2)

The angular velocity relations between the orbit, body and inertial frames are described
by the equation
bib = bio + bob = Rbo 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 section
explores the two most significant contributions to that torque, the magnetic and gravitational torques.
11

3.2.1

Dipole model

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

m
sinm
R2c

(3.4)

where m = 7.91015 is the earths dipole constant, Rc is the distance from the satellite
to the center of the earth and m the latitude with regard to the magnetic equatorial
plane. In [11] a series of operations and approximations is made, the most important
ones being regarding the magnetic and geographical pole as one and assuming an orbit
which passes directly over that pole to arrive at an expression for the magnetic flux in
the orbit frame:

cosm

0
Bo = B0
(3.5)
2sinm
where B0 = Rm3 = 2.3321 105 at a satellite altitude of 600km. The transformations
c
between the orbit and body frame is obtained by using the rotation matrix:
Bb = Rbo Bo

3.2.2

(3.6)

Magnetic torque

The magnetic coils in the satellite design can be used for attitude control by interaction with the Earths magnetic field, since they will produce a magnetic field of their
own when current flows through the windings. An apparant problem with this control
method is that it wont be possible to set up an arbitrary torque, but that is dealt with
by the controllers later on. The satellite will be built according to a double cubesat
standard, which means the cross-section of two of the coils will cover an area twice the
size of the cross-section of the third coil, and the total torque due to the coils is given
in [11] as
bm = mb Bb
(3.7)
where mb is the total dipole moment generated by the inductors:

Nx Ax ix
mb = mbx + mby + mbz = Ny Ay iy
Nz Az iz

(3.8)

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

3.2.3

Gravity gradient torque

The gravity gradient affects a non symmetric object in the Earths gravity field, and is
regarded as a disturbance torque which can not be controlled. According to [13] the
gravity gradient is given as
3
g = 3 ue (Iue )
(3.9)
Rc
where = 3.987 1014 is the Earths gravitational coefficient, I the inertia matrix, Rc
is again the distance between the satellite and the center of the Earth and ue is the unit
vector toward nadir. Using the third column vector of Rbo , c3 and the diagonal inertia
matrix I, as in [11] the gravitational torque is then simplified to:

(i33 i22 )c23 c33


bg = 302 (i11 i33 )c33 c13
(3.10)
(i22 i11 )c13 c23
where 02 =

3.3

.
R3c

Linearization

In order to apply a linear optimal controller on the system, the satellite equations needs
to be linearized. The linearization will be used in a controller for stabilization close
to the reference, so the system is linearized around the equilibrium point = 1, =
b = 0 and Ro = 1.
0, ob
b

3.3.1

Rotation matrix

When the rotation matrix between the body and orbit frame from equation 2.11 is
linearized it results in:
(3.11)
Rob = I 3x3 + 2S()
If this is transposed and expanded, the linearized rotation matrix from orbit to body
ensues
1

3 2
c11 c12 c13
2
1
Rbo = 2 3
(3.12)
1 = c21 c22 c23
2
1
c
c
c
2 1
31
32
33
2

3.3.2

Satellite model

Linearizing q from equation 3.2 around the reference point results in the linearized
system

 

0

q =
= 1 b
, bob = 2
(3.13)

2 ob
for the satellites orientation. Further, the angular velocity, equation 3.3, is linearized
as

21 20 3
(3.14)
bib = 22 + 0
0 1
23 + 2
13

and the time derivative of bib

21 20 3

22
bib =
23 20 1

3.3.3

(3.15)

Torque

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

(Iz Iy )1
bg = 602 (Iz Ix )2
(3.16)
0
The magnetic torque can be linearized as bm = S(mb )Bo , which results in

Boz my
bm = Box mz Boz mx
Box my

3.3.4

(3.17)

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 ]

(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)
where A and B(t) are given as

0
1
4kx 2
0
0

0
0
A=

0
0

0
0
0
(1 kz )0

B(t) =

0
0
0
3ky 02
0
0
0
0
0
1 o
2Iy Bz
0
1 o
2Iz By

0
1 o
2Ix Bz
0
0
0
1 o
2Iz Bx

and
kx =
ky =
kz =

(3.20)

0
0
0
0
1
0
0
0
0
0
0 kz 02

0
(1 kx )0
0
0
1
0

2I1x Boy
0
1 o
2Iy Bx
0
0

Iy Iz
Ix
Ix Iz
Iy
Iy Ix
Iz

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

(3.21)

(3.22)

(3.23)

Chapter 4

Energy & Stability


4.1

Energy

The energy of the satellite is made up by kinetic and potential components. The kinetic
energy mainly stems from rotation in the inertial and orbital frame and potential energy
from the gravity gradient and gyro effects from the revolutions around the earth. The
following 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 body
frame with respect to the orbit frame
1 b T b
Ekin = (ob
) Iob
2

4.1.2

(4.1)

Potential energy

The potential energy due to the gravity gradient and and revolution about the earth are
respectively
3
Egg = 02 ((cb3 )T Icb3 Iz
(4.2)
2
1
(4.3)
Egyro = 02 (Ix (cb1 )T Icb1
2

4.2

Lyapunov function

A commonly used Lyaunov function candidate is the energy function


V

= Etot = Ekin + Egg + Egyro


1 b T b
3
1
=
( ) Iob + 02 ((cb3 )T Icb3 Iz ) + 02 (Ix (cb1 )T Icb1 )
2 ob
2
2
15

(4.4)
(4.5)

which satisfies
V (0) = 0

(4.6)

V (x) < 0x 6= 0

(4.7)

is positive definite, proven in [10], and has the four equilibria for V (0)
{( bob , cb1 , cb3 ) : (0, co1 , co3 )}

(4.8)

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


b T b
V = (ob
) m

16

(4.9)

Part II

Control

17

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 control
objective. Further work should have more clearly defined goals, such as being able
to point a camera towards the earth and possibly rotating the satellite about an axis
to keep an even temperature distribution over the solar panels. Information from the
power management section of the project suggests 0.1watts of continuous power is
available for the ADCS system.

5.2

Determination

Attitude determination is the subject of a masters thesis being written by other members of the NUTS team, using a new approach to the QUEST method. This report
assumes the determination problem solved by other parts of the system, and that the
measurements 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, a
simple and widely used controller for detumbling is the control law
b

mb = kB 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 using the IGRF model, and simulation results are available, see figures 5.1 and 5.2
18

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

Figure 5.2: Attitude of the body frame after detumbling


19

5.4

Stabilization

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

5.4.1

Energy based controllers

Various energy based controllers have been investigated extensively in previous reports
written for the NCUBE-1 and NCUBE-2 projects, a short summary of two different
and widely used approaches will be given here.
Angular velocity feedback
Also known as the Wisniewski controller, the control law is given by
b
Bb
mb = hob

(5.2)

The controller can be shown to be stable about the equilibria


b
, cb3 , cb1 ) : (0, co3 , co1 )}
{(ob

(5.3)

by insertion into equation 4.9:


b
V = ( bob )T (Hob
Bb Bb )

(5.4)

as done in [4].
Attitude feedback
The angular velocity feedback controller doesnt give any control about the z-axis, so
a different controller which incorporates an attitude feedback term is suggested. This
control law is given by
b
mb = hob
Bb Bb
(5.5)
which is stable about
b
{(ob
, cb3 , cb1 ) : (0, co3 , 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 quadratic
controller. LQ controllers are known to be reliable and robust about the reference. The
LQ controller will here be applied to the linearized system from section 3.3:
x(t)
= Ax(t) + B(t)u(t)
with the A and B(t) matrices found in equations 3.21 and 3.22.
20

(5.7)

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

1 T T
[x Qx + uT Pu]dt
(5.8)
J(u) =
2 t0
where x is the deviation from the reference attitude which in this case is zero, u is
actuator usage and Q, P positive semidefinite weighting matrices. The system is known
to fulfill the controllability condition, and so the solution to the LQ problem is found
by solving the continuous Riccati equation
= R(t)A AT R(t) + R(t)B(t)P1 BT (t)R(t) Q
R(t)

(5.9)

which gives the control law


u(t) = P1 B(t)T R(t)x(t)

(5.10)

This is said to be a very computationally demanding controller, as the matrix R(t) has
to be computed for each time step. A solution to this has been suggested, namely
to compute R(t) off-line and store it in a look-up table. However, that problem and
solution dates back to 1989 [9] and computational power might have improved enough
by now that this isnt nescessary and as such merits a closer look further down the line
of the NUTS project.
A different solution is to take advantage of the near periodicity of the geomagnetic
field and use the mean value of Bo to make the system time invariant. The system from
equation 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) = P1 BT Rx(t)

(5.12)

The near periodicity concerns the IGRF model of the Earths magnetic field, as the
dipole model of course is perfectly periodic and the results in this report will reflect
that.
This leaves the weighting matrices to be chosen, they are the tuning parameters of the
controller, 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
1
and pii =
(xi )2
(ui )2

(5.13)

where xi and ui are viewed as nominally acceptable deviations in the state and actuator use respectively.

21

Chapter 6

Simulations
6.1

Simulation parameters

Parameter

Value

Weight
Size
Moments of inertia

2.66 kg
0.1x0.1x0.2 m
Ix = 0.0111, Iy = 0.0111, Iz = 0.0044 kgm2

Coil windings
Coil voltage
Coil resistance
Maximum coil current

Nx = 450, Ny = 450, Nz = 800


5V
100
0.05 A

Orbit height
Orbit inclination

600 000 m
98

6.2

Energy based controllers

These controllers are mainly used when the deviation from reference is large, where
either 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 are
chosen as
b
ob
= [0.001, 0.006, 0.004]
(6.1)
[ , , ] = [50, 30 40]

6.2.1

(6.2)

Angular velocity feedback

The controller used is found in equation 5.2:


b
mb = hob
Bb

22

(6.3)

with h = 2.5 105 as the tuning parameter. Figure 6.1 shows that the controller slows
the angular velocity and reduces the energy in the system, but it cant control all three
Euler angles to zero, as expected. From figure 6.2 it can be seen that the peak power
usage is well within the power usage requirements. Also interesting is the total power
consumed by this controller, which can be seen in figure 6.3 to be roughly 0.75W over
10 orbits.

Figure 6.1: Angular velocity feedback controlled variables


23

Figure 6.2: Angular velocity feedback actuator and power usage

24

Figure 6.3: Angular velocity feedback total power consumed

6.2.2

Attitude feedback

The controller used is found in equation 5.5:

b
mb = hob
Bb Bb

(6.4)

with h = 2.5 105 and = 150 as tuning parameters. This controller both slows
the angular velocity and brings all the Euler angles to zero while reducing the total
energy in the system, as seen in figure 6.4. The peak power usage is again well within
our constraints and is quite similar to the results from the angular velocity feedback
controller, shown in figures 6.5 and 6.6
25

Figure 6.4: Attitude feedback controlled variables

26

Figure 6.5: Attitude feedback actuator and power usage

27

Figure 6.6: Attitude feedback total power consumption

28

6.3

Optimal controllers

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

around

1
10

bob = [0.0001, 0.0006, 0.0003]

(6.5)

[ , , ] = [5, 9, 4]

(6.6)

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 the
Earths magnetic field is used. As discussed by Busterud[2], setting the y component
of Bo as zero in equation 3.5 further leads to several additional zero components in the
matrix B from equation 3.22. This B matrix is used to compute the LQ gain matrix and
might lead to singularities in the controller. In further work, the dipole model will be
replaced by the more accurate IGRF model, and the problem solves itself, but as far
as the simulations in this report is concerned a small periodic perturbation was simply
added to the By component. The dipole model is by itself not accurate enough that this
should 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 investigated, found in equation 5.10 as
u(t) = P1 B(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
2
( 60
180 )

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 have
shown that it doesnt make any difference either way.
This controller quickly reaches the reference attitude, as seen in figure 6.7, but what
makes this controller really stand out is the power consumption. Looking at figures 6.8
and 6.9, this controller reduces the power consumption at least by a factor of ten compared to the other controllers, not compensated for the smaller initial values compared
to the energy based controllers.
29

Figure 6.7: Time varying LQR controlled variables

30

Figure 6.8: Time varying LQR actuator and power usage

31

Figure 6.9: Time varying LQR total power consumption

6.3.2

Time invariant system

Found in equation 5.12


u(t) = P1 BT Rx(t)

(6.9)

with weighting matrices


Q = diag[1 0 1 0 1 0]

1
1
and P = diag[1 1 1]
2
2
(0.01)
( 10
)
180

(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 matrices
are very sensitive to small changes. It is a fairly good controller within the scope
of this report, but the conditions can be seen as somewhat ideal and unrealistic, like
using the average values of a dipole model for the magnetic field for this controller,
B = [9.8757 108 5.0828 1012 1.1407 106 ]. In addition it uses quite a lot of
power compared to the time varying controller, shown in figures 6.11 and 6.12
32

Figure 6.10: Time invariant LQR controlled variables

33

Figure 6.11: Time invariant LQR actuator and power usage

34

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 most
robust choice seems to be combining the angular velocity feedback controller for the
initial satellite stabilization with the time varying LQ controller for keeping it stable.
Both the attitude feedback controller and the time invariant LQ controller definitely
have their advantages, but the attitude feedback controller was quite hard to tune, and
I suspect it wont respond well to a wider range of initial conditions. While the gain
matrix calculations for the time invariant LQ controller is a lot faster than for the time
varying controller, it remains open whether this is a factor that should be emphasized
or not. For now I will place more weight on the wider range of initial conditions and
tuning parameters supported by the time varying controller combined with the supreme
power saving possibilities.
This is in tune with the conclusion of previous comparable reports, and shows that the
double cubesat, not unexpectedly, shares a lot of properties with the standard single
cubesat attitude control wise.

35

Part III

Conclusion

36

Chapter 7

Concluding remarks
In this project work different controllers for the ADCS system of the NUTS project
have been investigated and compared.
Both energy based controllers and optimal controllers show satisfactory results for different control cases, and the best choice depends on whether or not hardware constraints come into play. All of the controllers stay within the power budget of 0.1W
maximum power use, but the time varying LQ controller singles out as the one with the
lowest power consumption. Given that computation power is adequate, a combination
of an angular velocity feedback controller and a time varying LQ controller should be
chosen for the stabilization phase of the ADCS system, given the choice between the
widely used controllers investigated in this report.
Further work on the satellite project regarding optimal control could include checking
whether the hardware really places constraints on the use of time varying LQ controller
or not. Another interesting prospect to investigate further could be using an MPC controller for the attitude control. A different approach alltogether could be the inclusion
of different kinds of actuators and various forms of passive stabilization.

37

Bibliography
[1] Gaute Brthen. Nonlinear attitude control of a double cubesat using magnetorquers. 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 Engineering
Cybernetics, NTNU, 2002.
[5] K.M. Fauske. Attitude Stabilization of an Underactuated Rigid Spacecraft. Siving theis, Department of Engineering and Cybernetics, Norwegian University of
Technology and Science, pages 2730, 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. New
York, McGraw-Hill Book Co, 1983.
[8] S.V. Marshall and G.G. Skitek. Electromagnetic concepts and applications, volume 10. Prentice-Hall, 1990.
[9] K. MUSSER and W. EBERT. Autonomous spacecraft attitude control using magnetic torquing only. In NASA, Goddard Space Flight Center, Flight Mechanics/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. Norwegian University of Science and Technology. Department of Engineering Cybernetics, 2004.
[11] PK Soglo. 3-aksestyring av gravitasjonsstabilisert satellitt ved bruk av magnetspoler. Siv. Ing Thesis, Department of Engineering Cybernetics, NTNU (Norwegian), 1994.
[12] B. Vik. Integrated Satellite and Inertial Navigation Systems. Department of Engineering 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

Part IV

Appendix

39

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;

%Parameters
my = 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 constant
R_0 = 6371000; % Mean earth radius, [m]
r = R_0 + 600000; % Orbit radius
omega_0 = sqrt(my/R_0^3); % Angular velocity constant orbit w.r.t. inertial
omega_o_io = [0 -omega_0 0]; % Angular velocity of orbit w.r.t. inertial
orbitTime = (2*pi)/omega_0; % Approx orbit time
m
x
y
z

=
=
=
=

2.66; % Satellite mass, [kg]


0.1; % Length x-direction, [m]
0.1; % Length y-direction, [m]
0.2; % Length z-direction, [m]
40

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, 3x3
invI = 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 coils
R = 100; % Resistance coils
i_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 conditions
init_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 quaternions
init_omega_b_ib = [0.0001 0.0006 -0.0003]; %Init ang vel
lambda_0 = 0; %starting position in orbit

%Time invariant LQR gain matrix calculation


B = [9.8757e-008 5.0828e-012 1.1407e-006]; %Avg of mag. dipole strength
K = K2(B); %Gain matrix

%Initialization of the ode45 solver


t_end = 10*orbitTime; % Simulation time
init_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

A.2

The controllers

This file contains all the controllers, with the time invariant LQ controller active, the
rest 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 input


q = [x0(1) x0(2) x0(3) x0(4)];
q = quatnormalize(q); %Normalized quaternion
eta = q(1); %Separated quaternion, eta
eps = [q(2) q(3) q(4)]; %Separated quaternion, epsilon
omega_b_ib = [x0(5) x0(6) x0(7)]; %Angular velocity body relative inertial
lambda = x0(8); %"Position" of the satellite
% Compute the quaternion rotation matrix
R_o_b = eye(3) + 2*eta*Smtrx(eps) + 2*(Smtrx(eps))^2;%body to orbit
R_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-dot
eta_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 gravity
tau_g = 3*omega_0^2*cross(R_b_o(:,3), I*R_b_o(:,3));

42

%*************************************************************************
% CONTROLLERS
%*************************************************************************
%None
% m_b = [0 0 0];
%LQ
% K = K2(B); %Time varying LQ
m_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));
end
if min(ratio)<1
m_b = m_b*min(ratio);
end
% Power consumption
i(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 torque
tau_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

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 values
Ix = 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 field
Bx_0 = B(1);
By_0 = B(2);
Bz_0 = B(3);
% The linearized system
A = [0 1 0 0 0 0 ;
-4*kx*omega_0^2 0 0 0 0
0 0 0 1 0 0;
0 0 -3*ky*omega_0^2 0 0
0 0 0 0 0 1;
0 -(1 - kz)*omega_0 0 0

matrix
(1 - kx)*omega_0;
0;
-kz*omega_0^2 0];

% The input matrix for the linearized system


B = [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 matrices
Q = diag([1 0 1 0 1 0])*1/((10*pi/180)^2); %x
P = diag([1 1 1])*1/((0.01)^2); %u
% Calculate the gain matrix
K = -lqr(A,B,Q,P);
end

44

Potrebbero piacerti anche