Satdyn MB 2010f
Satdyn MB 2010f
Satdyn MB 2010f
Publication date:
2010
Document Version
Publisher's PDF, also known as Version of record
Citation (APA):
Blanke, M., & Larsen, M. B. (2010). Satellite Dynamics and Control in a Quaternion Formulation (2nd edition).
Technical University of Denmark, Department of Electrical Engineering.
General rights
Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright
owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights.
Users may download and print one copy of any publication from the public portal for the purpose of private study or research.
You may not further distribute the material or use it for any profit-making activity or commercial gain
You may freely distribute the URL identifying the publication in the public portal
If you believe that this document breaches copyright please contact us providing details, and we will remove access to the work immediately
and investigate your claim.
Satellite Dynamics and Control in a Quaternion
Formulation
-
Lecture note for course 31365
Spacecraft Dynamics and Control
at DTU
This lecture note treats modelling and attitude control design using a quater-
nion description of attitude for a rigid body in space. Dynamics and kine-
matics of a satellite is formulated as a non-linear model from Euler’s moment
equations and a description of kinematics using the attitude quaternion to
represent rotation. A general linearised model is derived such that the user
can specify an arbitrary point of operation in angular velocity and wheel
angular momentum, specifying the a inertia matrix for a rigid satellite. A
set of Simulinkr models that simulate the satellite’s nonlinear behaviour
are described and a Matlabr 1 function is described that has been written
to calculate the linear model in an arbitrary point of operation.
1
Matlab and Simulink are trademarks of MathWorks Inc. USA.
Contents
1 Introduction 3
1
CONTENTS 2
7 Attitude Control 29
7.1 Reference in both angular rate and attitude . . . . . . . . . . 30
7.2 Reference in Attitude . . . . . . . . . . . . . . . . . . . . . . 32
7.3 Stability Analysis and Simple Controller Design . . . . . . . . 33
Introduction
The purpose of this lecture note is to derive and provide the complete non-
linear model of a satellite with reaction wheels, using quaternion represen-
tation of attitude, and to derive the linearised equations of motion of such
satellite for use in linear analysis and control design. The note extends and
supplements the treatment of attitude models that are provided in section
4.8 and later in the book by Marcel J. Sidi [5], which is based on Euler
angle description of attitude. Sidi analyse a number of feedback schemes
in chapter 6, based on an Euler angle model and assuming small deviations
from a reference. In chapter 7, he introduces attitude control based on
quaternion error feedback. However, the complete quaternion based model
was not derived by [5]. A linearised model was needed in the quaternion
formulation as well.
When we wish to make an analysis of the quaternion feedback scheme
similar to that done in chapter 6, a small signal model is needed for the
satellite described with attitude represented as a quaternion.
This note is aimed at students at a first course in spacecraft dynamics
and control, at the first year of the MSc level, where participants have
different backgrounds. Therefore, this note starts with some prerequisites.
In chapter 2, we define models of linear time invariant (LTI) systems as a
set of coupled first-order differential equations, referred to as the state-space
formulation in the automatic control literature, and analysis of stability
properties are discussed. It is then shown how a continuous-time nonlinear
system is linearised, using the Jacobian to obtain the state-space model in
vector-matrix notation.
Chapter 3 considers the dynamics of a spacecraft with reaction wheels
and derives a model of spacecraft attitude dynamics and kinematics in a
quaternion representation. The dynamics associated with torque control of
reaction wheels1 are included in the model. Gravity gradient effects are not
included in this version.
1
The terms reaction wheel and momentum wheel are used as synonyms in this note.
3
CHAPTER 1. INTRODUCTION 4
5
CHAPTER 2. MODELS IN STATE-SPACE FORM 6
The final value theorem Eq. (2.5) shows how one finds the steady state value
of a bounded function x(t), from its Laplace transform x(s) as:
The transfer function Hyu (s) from input u(s) to output y(s) is
( )
y(s)= C (sI − A)−1 B + D u(s) ≡ Hyu (s)u(s), (2.10)
CHAPTER 2. MODELS IN STATE-SPACE FORM 7
where Hyu (s) has k rows (same as number of elements in y) and m columns
(same as number of inputs), Hyu (s) ∈ Ck×m . Each element in Hyu (s) is a
single-input single-output (SISO) transfer function from a particular input
to a particular output.
Since Hyu (s) = C (sI − A)−1 B + D, all transfer functions in Hyu (s)
have the same denominator, namely the polynomial det (sI − A) .The nu-
merators will in general be different from each other.
ẋ = g(ẋ, u),
(2.12)
y = h(x, y),
where x ∈ R1 , u ∈ R1 , y ∈ R1 . We wish to obtain a model that describes op-
˙ x̄, ū. Introduce deviations from the trajectory
eration around a trajectory x̄,
by
x̃ = x − x̄,
ũ = u − ū, (2.13)
ỹ = y − ȳ.
Then a Taylor expansion of Eq. (2.12) gives
∂g(x̄,ū) ∂g(x̄,ū)
x̃˙ + x̄˙ = g(x̄, ū) + ∂x x̃ + ∂u ũ + ...
(2.14)
∂h(x̄,ū) ∂h(x̄,ū)
ỹ + ȳ = h(x̄, ū) + ∂x x̃ + ∂u ũ + ...
Since x̄˙ = g(x̄, ū) and ȳ = h(x̄, ū) by definition of the ”bar” variables, and
truncation to first order of the Taylor series gives
∂g(x̄,ū) ∂g(x̄,ū)
x̃˙ = ∂x x̃ + ∂u ũ,
(2.15)
∂h(x̄,ū) ∂h(x̄,ū)
ỹ = ∂x x̃ + ∂u ũ.
This expression is linear in the tilted variables, i.e., we have obtained a linear
model. The parameters can be functions of the trajectory around which we
linearise.
ẋ = a0 + a1 x + a2 x2 + b1 u + b2 xu,
(2.16)
y = c1 x + c3 x3 .
A special case is that (x̄, ū) is time-invariant. In this case we obtain a linear
time-invariant system (LTI).
CHAPTER 2. MODELS IN STATE-SPACE FORM 9
x̃˙ = ∂g(x̄,ū,
∂x
d̄)
x̃ + ∂g(x̄,ū,d̄)
∂u ũ
(2.21)
ỹ = ∂h(x̄,ū,
∂x
d̄)
x̃ + ∂h(x̄,ū,d̄)
∂u ũ
This defines a linear system
x̃˙ = Ax̃ + Bu ũ
(2.22)
ỹ = Cx̃ + Du ũ
The matrices A, Bu , are defined by the derivatives of the vector valued
function g with respect to vectors x, and u (and C, Du equivalently by
differentiation of h):
A = ∂g(x̄,ū,
∂x
d̄)
C = ∂h(x̄,ū,
∂x
d̄)
(2.23)
∂g(x̄,ū,d̄) ∂h(x̄,ū,d̄)
Bu = ∂u Du = ∂u
The derivative of a vector with respect to a vector is referred to as the
Jacobian,
∂g1 ∂g1 ∂g1
∂u1 ∂u2 ··· ∂um
∂g2 ∂g2
··· ∂g2
∂g(x̄, ū, d̄) ∂u1 ∂u2 ∂um
=
.. .. ..
(2.24)
∂u ..
. . . .
∂gn ∂gn ∂gn
∂u1 ∂u2 ··· ∂um
CHAPTER 2. MODELS IN STATE-SPACE FORM 10
hence
ẋ1 = a0 + a1 x1 x2 + a2 x21 + b1 u1 + b2 x2 u1
ẋ2 = a4 x21 x22 + b1 u1 + b3 x21 u1
y = c1 x1 + c3 x1 x22 ,
and application of differentiation as defined in Eq. 2.24 gives:
[ ]
[ ] x̃1
x̃˙ 1 = a1 x̄2 + 2a2 x̄1 a1 x̄1 + [b1 + b2 x̄2 ] ũ1
x̃2[ ]
[ ] x̃1 [ ]
x̃˙ 2 = 2a4 x̄1 x̄2 + 2b3 x̄1 ū1 2a4 x̄1 x̄2
2 2 + b1 + b3 x̄21 ũ1 (2.25)
x̃
[2 ]
[ 2
] x̃1
ỹ = c1 + c3 x̄2 2c3 x̄1 x̄2 .
x̃2
A rotation is described by the rotation matrix [5, Eq. A.4.15] where the four
elements of the quaternion are the parameters used in the rotation matrix.
The standard form of satellite dynamics, with satellite inertia matrix Is ,
angular velocity of the satellite ω and hw is the total angular momentum
of wheels, all seen in the satellite’s coordinate system, Ne is total external
torque. With this notation, the dynamic equation reads
d
(Is ω) + ḣw = Ne − ω × Is ω − ω × hw (3.3)
dt
or
ω̇ = −I−1 −1 −1 −1
s (ω × Is ω) −Is ω × hw − Is ḣw + Is Ne (3.4)
Writing the cross product as a matrix operation using S() makes the
notation simpler in the sequel
0 −ω3 ω2
S(ω) = ω3 0 −ω1 (3.5)
−ω2 ω1 0
11
CHAPTER 3. SATELLITE EQUATIONS OF MOTION 12
gives
ω̇ = −I−1 −1 −1 −1
s S(ω)Is ω − Is S(ω)hw − Is ḣ + Is Ne (3.6)
The combined nonlinear dynamic model of the satellite is completed by
noting that control torque in the body coordinate system is Nc and gives
the rate of change of the total angular momentum from wheels,
ḣ = −Nc , (3.7)
ω̇ = −I−1 −1 −1 −1
s S(ω)Is ω − Is S(ω)h + Is Nc + Is Ne . (3.8)
3.2 Kinematics
The kinematics of the satellite, is described using the attitude quaternion q
= [q1 , q2 , q3 , q4 ]T to represent a rotation. The orientation of the satellite is
obtained rotating from the inertial frame to the satellite frame by the direc-
tional cosine (rotation) matrix ASI . The rotation matrix is parameterized
by the quaternion, ASI (qSI ) or just ASI (q) for brevity. A vector measured
in the inertial frame is aI, the vector measured in the satellites body frame
has coordinates aS , then aS = ASI (q)aI . The kinematics of the satellite is
then
q1 0 ω3 −ω2 ω1 q1
d
q2 = 1 −ω3 0 ω1 ω2
q2 (3.9)
dt q3 2 ω2 −ω1 0 ω3 q3
q4 −ω1 −ω2 −ω3 0 q4
In a compact notation,
1
q̇ = Ω(ω)q (3.10)
2
This compact notation is subsequently referred to in block diagrams. An-
other form of the detailed kinematics is also useful in the further analysis.
Equation 3.9 is easily rewritten to separate terms with q4 from other ele-
ments of the quaternion. Define a vector part of the first three components
of the quaternion and denote this by g, which is referred to as the Gibbs
vector
q1
g = q2 , (3.11)
q3
then 3.10 reads
1 1
ġ = − ω × g+ q4 ω (3.12)
2 2
1 T
q̇4 = − ω g
2
CHAPTER 3. SATELLITE EQUATIONS OF MOTION 13
Ne
Satellite dynamics Satellite kinematics
³ ³
Nc
+ Is -1
-1
hw
+ S( ) ½
Is
Is
Figure 3.1: Satellite model with nonlinear dynamics and kinematics, Equa-
tions 3.4 and 3.10, hw is the angular momentum of wheels, Ne an external
torque and Nc the control torque from reaction wheels, all given in the SBC
system. Output is q and ω
The unit length of the quaternion is preserved in this operation. The model
of the satellite comprise the dynamics from Equation 3.4 and the kinematics
from Equation 3.10. This model is illustrated in Figure 3.1
CHAPTER 3. SATELLITE EQUATIONS OF MOTION 14
When a reaction wheel is used as actuator, ḣ of the wheel provides the (nega-
tive) control torque on the satellite and the angular momentum of the wheel
hw (which was measured in satellite coordinates) gives a cross-coupling term
in the dynamic equations of motion of the satellite, see Equation 3.4.
If the wheel assembly consists of several wheels, say four, we have the
directional cosines for each wheel in the columns of the direction matrix for
CHAPTER 3. SATELLITE EQUATIONS OF MOTION 15
the wheels,
hw1
h1 a11 a12 a13 a14
h2 = a21 a12 a13 a14 hw2 (3.19)
hw3
h3 sbc a31 a12 a13 a14
hw4
Abbreviated to vector form, this is
h = Aw hw (3.20)
The matrix Aw has three rows and a number of columns equal to the
number of reaction wheels in the satellite.
h −Nc
CHAPTER 3. SATELLITE EQUATIONS OF MOTION 16
-1
Nc
A: Idealized wheel model
dhw/dt
Ndw hw
-1
B: Model with wheel-servo Nc
dynamics included
dhw/dt
Ndw hw
³ ³
+ 1
Ww
-
Figure 3.2: Schematic wheel control loop. The upper part (A) shows the
idealized model where ḣ is identical to the demand torque. The bottom
part (B) shows a more realistic configuration where a speed control servo
loop is closed around the wheel. This gives the generation of ḣ a low-pass
behaviour. The bandwidth of the ḣ loop is equal to ωw .
CHAPTER 3. SATELLITE EQUATIONS OF MOTION 17
-1 Aw
dhw/dt
hw
Nd
³ ³
1
AwT + Aw
Ww
-1
³ ³
Nc
+ Is -1
-1
+ S( ) ½
Is
Is
Figure 3.3: Satellite model with reaction wheel assembly as actuator, satel-
lite dynamics and kinematics.
CHAPTER 3. SATELLITE EQUATIONS OF MOTION 18
d ( )
Apb Isb ATpb Apb ω b = −Apb ω b × Apb Isb ATpb Apb ω b (3.26)
dt
−Apb ω b × Apb hpb − Apb ḣpb + Apb Ne,b + Apb Ndist,b
d
(Isb ωb ) = −ω b × Isb ω b −ω b ×hb − ḣb + Ne,b + Ndist,b (3.27)
dt
which is again the dynamics in its original structure but now expressed in
body axes instead of principal axes.
Chapter 4
The torque on the satellite is Nc = −Aw Ndw where Ndw is the wheel
torque demand and Aw the distribution matrix for wheel torque that is
defined in the Matlab program RWA sim.m. The distribution matrix has
its number of columns equal to the number of wheels. The number of rows
is always 3, since the Nc torque is the torque the three axes of the satellite
coordinate system.
The spacecraft parameters used are, as an example:
19
CHAPTER 4. NONLINEAR SIMULATION MODEL 20
Nw_dem
q_sat
To Workspace5
To Workspace
1
Nw_dem Nw_dem
Qeci2scb 1
Qics2sbc
2 w_w_ini
w_w_ini scbWbody 2
q_sat_init wbody_sbc
w_wheels 3
(0.0 0.0 0.0 1.0) w_sat_init
w_wheels
q_sat_init Rigid Body
To Workspace6 To Workspace1
w_sat_ini
12:34
Figure 4.1: Simulink mainwindow for sat3 sim.mdl. Input are control torque
demand, initial values for attitude quaternion of satellite, angular rate of
satellite, initial val be present in the workspace before you start a simulation.
3
q_sat_init
4
w_sat_init In q4 notation
Initial quaternion
initial rate
Qeci2scb 1
[0,0,0] scbNdist Qeci2scb
Ndist = 0 scbWbody scbWbody
scbHw
Kinematics
scbNw
2
Satellite body dynamics scbWbody
sbcHw
1 Nw_dem
Nw_dem
sbcNw
2 w_w_ini
w_wheels 3
w_w_ini
w_wheels
Momentum wheels
scbWbody
scbNcc
3 scbHw
scbHw
Spacecraft Body
4 −1 K*u
scbNw 1
−1 Gain Iscb^−1 s 1
xo scbWbody
2
scbNdist
Initils
1
initial rate
signal1
f(u) signal1
2 signal2
scbWbody Fcn1
f(u) signal2
Fcn2 1
xo s Q Norm 1
f(u) signal3 Qeci2scb
Normalization
Fcn3
f(u) signal4
Fcn4
1
Initial quaternion Initials
1 K*u 1
Nw_dem xos
Jest^−1
Integrator1
3
w_wheels
K*u K*u 1
xos K*u 1
Matrix Saturation J^−1 sbcHw
Gain Integrator2 J*A_w
K*u 2
sbcNw
A_w
2
w_w_ini
• An example with three orthogonal wheels aligned with the axes of the
satellite gives the distribution matrix
1 0 0
Aw = 0 1 0 . (4.2)
0 0 1
Chapter 5
d 1 1 1
g̃ = − S(ω)g̃+ q̃4 I3×3 ω = I3×3 ω (5.2)
dt 2 2 2
d d
h = h̄ + h̃; h = h̃ (5.3)
dt dt
The desired form of the linear equation of motion has a state vector
and has control input u = Nc . The external and disturbance torques have
zero mean. The state space equation is then
where
∂fi ∂fi
Aij = ; Bij = (5.5)
∂xj ∂uj
23
CHAPTER 5. LINEAR MODEL FOR ANALYSIS 24
and −1
−I−1 −1
s S(ω)Is ω − Is S(ω)h + Is (Nc + Ndist )
− 12 S(ω)g+ 12 q4 I3×3 ω
f =
(5.6)
−2ω g
1 T
−Nc
Using symbolic manipulation to calculate the Jacobians Eq. 5.5, we obtain
I−1
s Aω,ω 0 I−1
s Aω,h
A = 12 I3×3 0 0 ; (5.7)
0 0 0
−1 −1
Is Is
Bu = 0 ; Bd = 0 ;
−I3×3 0
with
Aω,ω = [Aω,1 , Aω,2 , Aω,3 ] (5.8)
and the three columns of Aω,ω are
ω2 I31 −ω 3 I21
Aω,1 = −2I 31 ω1 −I 32 ω2 −ω 3 I33 +ω 3 I11 +h3 (5.9)
I21 ω1 +ω 2 I22 +I 23 ω3 −ω 2 I11 −h2
I31 ω1 +2I 32 ω2 +ω 3 I33 −ω 3 I22 −h3
Aω,2 = ω3 I12 −ω 1 I32 (5.10)
−ω 1 I11 −2I 12 ω2 −I 13 ω3 +ω 1 I22 +h1
−I 21 ω1 −ω 2 I22 −2I 23 ω3 +ω 2 I33 +h2
Aω,3 = ω1 I11 +I 12 ω2 +2I 13 ω3 −ω 1 I33 −h1 (5.11)
ω1 I23 −ω 2 I13
Further,
0 ω3 −ω2
Aω,h = −ω3 0 ω1 (5.12)
ω2 −ω1 0
Equation 5.4 with matrices defined in Equations 5.7, 5.8, 5.9, 5.10, 5.11
and 5.12 constitute the linear model of the satellite in an arbitrary nominal
condition (point of operation). The nominal condition is expressed through
the parameters ω = ω̄, the average angular rate of the satellite, and h = h̄,
the average stored angular momentum expressed in satellite body coordi-
nates.
This linear model accept an arbitrary moment of inertia tensor, which
enables subsequent use for both controller design and analysis of sensitivity
(robustness) properties. Uncertainties include magnitude and rotation of
the inertia tensor and alignment of wheels. The basic dynamic properties
CHAPTER 5. LINEAR MODEL FOR ANALYSIS 25
change with the resulting angular momentum of the wheels. The changes
in linear dynamics could be analyzed should the satellite be demanded to
rotate along one of its axes, e.g. during maneuvers. The linear model is
then available should quantitative analysis be desired. Nonlinear analysis is
limited to mainly stating the more fundamental question of stability.
Ixx 0 0
Is = 0 Iyy 0 [kgm2 ] (5.14)
0 0 Izz
The nominal model for small signals (linear model) case is hence, when
the satellite has ω = 0,
I−1
s Aω,ω 0 0
1
0 0 ;
A= 2 I3×3 (5.15)
0 0 0
−1
Is I−1
s
Bu = 0 ; Bd = 0 ; (5.16)
−I3×3 0
I−1
s Aω,ω 0 I−1s Aω,h −I−1
s
1 I3×3 0 0 0
A=
2 , (5.19)
0 0 0 I3×3
0 0 0 −kw I3×3
−1
0 Is
0 0
Bu =
, Bu =
0
0
−kw I3×3 0
Note that torque demand and the wheel angular momentum vectors are in
satellite body coordinates in this equation.
The wheel dynamics should be included when a high performance satel-
lite control loop is designed. For more basic designs, it is certainly sufficient
to choose gains in the satellite attitude control such that the poles of the
closed loop satellite control are 10-15 times lower than the wheel bandwidth
(w bw in the parameter list below). The poles for the satellite with closed
loop attitude control are found using either of the following Matlab com-
mands
damp(satmodcl) or
[p,z]=pzmap(satmodcl)
on the LTI structure satmodcl for the closed loop system. The latter com-
mand provides both system poles and system zeros.
Chapter 6
The different versions of the models described above are calculated by the
Matlab function lin sat wheels mod. The call is
[satmod c, satmod dist] = lin sat wheels mod(Is, ws, hs, w bw, Ts)
To obtain the model of Eq. 5.4 for the case with idealized wheels, use the call
The result is a set of two Matlab LTI (Linear Time Invariant) structures,
satmod c, satmod dist, that comprises the system description in state space
27
CHAPTER 6. MATLAB FUNCTION TO GET LINEARISED MODEL28
form. The first comprise the model using wheel torque as input. The second
describes the system using disturbance torque as input. The matrices of the
state space model can be retained using the command
[satmod c, satmod dist] = lin sat wheels mod(Is, ws, hs, w bw, Ts)
Attitude Control
where Kp and Kpd are controller gain matrices, ω the angular velocity vector
of the satellite and qe is the quaternion error,
q1e q4r q3r −q2r −q1r q1s
q2e −q3r q4r q1r q2r
= q2s (7.2)
q3e q2r −q1r q4r −q3r q3s
q4e q1r q2r q3r q4r q4s
i.e. a quaternion that describes the rotation needed to align the satellite
body coordinate axes with those of the target coordinate system. The
quaternion qs describes the rotation to go from inertial axes to statelite
body coordinate system axes, qr the rotation of inertial axes to the refer-
ence (target) coordinate system axes.
The feedback in Eq. 7.1 has qt as reference for pointing, but no reference
in ω. When we want to make a reorientation manoeuvre with a spacecraft, it
could be convenient to introduce a reference also in ω, to make a maneuvre
that can follow an angular rate, e.g. when a satellite shall track another
object or a point on Earth. A control law with reference in both quaternion
and in angular velocity is:
where
ωe = ωs − ωr (7.4)
29
CHAPTER 7. ATTITUDE CONTROL 30
³
(gref, wref)T
Ndem
K Bu C
+
reference
+
(gs, ws, hw )T
T
(gs, ws)
A (gs, ws)T
measurements
Figure 7.1: Closed loop with output feedback and reference to the loop from
both ω and g in the linear state space representation of the satellite.
We will analyse both cases in the sequel, Eq. 7.3 with reference values
in both angular velocity and attitude, Eq. 7.1 with reference quaternion but
zero angular velocity as reference.
qe = q−1
s qr (7.6)
ωe = ωs − ωr (7.7)
[ ]
Nd = Kpd Kp (yr − y)
[ ] [ ]
= − Kpd Kp Cx+ Kpd Kp yr (7.10)
= −Ky Cx + Kr yr
[ ]
where ] lines define the gain matrices Ky = Kpd Kp and
[ the last two
Kr = Kpd Kp .
The transfer function from reference to output with the closed feedback
is then
y(s) = C(sI9,9 − (A − Bu Ky C))−1 Bu Kr yr (s) (7.11)
The form of this expression is
with
Acl = (A − Bu Ky C) (7.13)
[ ]
Bcl = Bu Kr = Bu Kpd Kp (7.14)
Ccl = C and Dcl = 06,6 (7.15)
The closed loop transfer functions 7.12 are calculated using the commonplace
Matlab functions (see below), using the LTI system definition
Ndem +
³
[ gref ]T [ws, gs]T
+ +
Kr Bu C
+ + +
Reference
for g only [ws, gs, hw ]T
- Ky
measurements
[ws, gs]T
- Ky
Figure 7.2: Closed loop with output feedback and reference to the loop from
g only. Linear state space model of the satellite.
[ ]
Nd = − Kpd Kp y + Kp gr
[ ]
=− Kpd Kp Cx + Kp gr (7.17)
= −Ky Cx + Kr gr
where the last two lines define the gain matrices Ky and Kr The transfer
function from reference to output is therefore
Acl = (A − Bu Ky C) (7.19)
Bcl = Bu Kr = Bu Kp (7.20)
Ccl = C and Dcl = 06,3 (7.21)
we can again analyse the closed loop system using the form
14.3 0 0
Is = 0 13.6 0 [kgm2 ] (7.24)
0 0 4.6
Define the desired bandwidth of the closed-loop system by ωbw cls = 0.2
[rad/s]. A simple design approach is to select gains to be
2
kp (j) = Is (j, j)ωbw cls
kpd (j) = 2Is (j, j)ωbw cls (7.25)
pole zero plot open loop pole zero plot closed loop
0.1 0.1
0.08 0.08
0.06 0.06
0.04 0.04
0.02 0.02
imag
imag
0 0
−0.02 −0.02
−0.04 −0.04
−0.06 −0.06
−0.08 −0.08
−0.1 −0.1
−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 −0.25 −0.2 −0.15 −0.1 −0.05 0 0.05
real real
Figure 7.3: R loop (b). Angular velocity is ωs = [0; 0; 0] rad/s and angular
momentum is hs = [0; 0; 0] Nms. The closed loop eigenvalues are all in -0.2
as intended. The small imaginary part is due to numerics. Three eigenvalues
at the origin are cancelled by three zeros. The origin of this is the physical
integration from ḣ to h.
pole zero plot open loop pole zero plot closed loop
0.01 0.01
0.008 0.008
0.006 0.006
0.004 0.004
0.002 0.002
imag
imag
0 0
−0.002 −0.002
−0.004 −0.004
−0.006 −0.006
−0.008 −0.008
−0.01 −0.01
−0.01 −0.008 −0.006 −0.004 −0.002 0 0.002 0.004 0.006 0.008 0.01 −0.01 −0.008 −0.006 −0.004 −0.002 0 0.002 0.004 0.006 0.008 0.01
real real
pole zero plot open loop pole zero plot closed loop
0.1 0.1
0.08 0.08
0.06 0.06
0.04 0.04
0.02 0.02
imag
imag
0 0
−0.02 −0.02
−0.04 −0.04
−0.06 −0.06
−0.08 −0.08
−0.1 −0.1
−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 −0.25 −0.2 −0.15 −0.1 −0.05 0 0.05
real real
Figure 7.5: Roemer-like satellite pole-zero plot for open (a) and closed loop
(b). Angular velocity is ωs = [0; −0.003; 0] rad/s and angular momentum
hs = [0; 0; 0.5] Nms. The angular velocity around the y-axis, and the mo-
ment of inertia with Ix < Iy < Iz , cause the open loop system to be unstable.
The closed loop is stable with closed loop poles only slightly affected by the
perturbation of the open loop system.
pole zero plot open loop pole zero plot closed loop
0.01 0.01
0.008 0.008
0.006 0.006
0.004 0.004
0.002 0.002
imag
imag
0 0
−0.002 −0.002
−0.004 −0.004
−0.006 −0.006
−0.008 −0.008
−0.01 −0.01
−0.01 −0.008 −0.006 −0.004 −0.002 0 0.002 0.004 0.006 0.008 0.01 −0.01 −0.008 −0.006 −0.004 −0.002 0 0.002 0.004 0.006 0.008 0.01
real real
pole zero plot open loop pole zero plot closed loop
0.1 0.1
0.08 0.08
0.06 0.06
0.04 0.04
0.02 0.02
imag
imag
0 0
−0.02 −0.02
−0.04 −0.04
−0.06 −0.06
−0.08 −0.08
−0.1 −0.1
−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 −0.25 −0.2 −0.15 −0.1 −0.05 0 0.05
real real
Figure 7.7: Roemer-like satellite pole-zero plot for open (a) and closed loop
(b). Angular velocity is ωs = [0; −0.003; 0] rad/s and angular momentum
hs = [0; 0; 0.5] Nms. The bias in angular momentum has moved the open
loop pole-zero pattern significantly. Despite the large perturbation, the
closed loop poles show that the closed loop system is still nicely damped.
pole zero plot open loop pole zero plot closed loop
0.01 0.01
0.008 0.008
0.006 0.006
0.004 0.004
0.002 0.002
imag
imag
0 0
−0.002 −0.002
−0.004 −0.004
−0.006 −0.006
−0.008 −0.008
−0.01 −0.01
−0.01 −0.008 −0.006 −0.004 −0.002 0 0.002 0.004 0.006 0.008 0.01 −0.01 −0.008 −0.006 −0.004 −0.002 0 0.002 0.004 0.006 0.008 0.01
real real
[2] Peter C. Huges. Spacecraft Attitude Dynamics. John Wiley and Sons,
1986.
[7] Bong Wie. Space Vehicle Dynamics and Control (2nd edition). American
Institute of Aeronautics and Astronautics, 2008.
38
Appendix A
The CD enclosed with the printed version of this report comprise the func-
tions listed below. The files are available for participants in DTU course
31365: Spacecraft Dynamics and Control via file-sharing at the DTU Cam-
pusnet.
39
APPENDIX A. PROGRAMME LISTINGS AND CONTENTS CD 40
A.1 linSatModNogg
function [satmod_c, satmod_dist] = lin_sat_wheels_mod(Is, ws, hw,
tau_w, Ts)
%
% procedure to get system matrices of satellite with
momentum wheels
% and no gravity gradient
%
% Terms:
% SBC Satellite
Body Coordinate system
%
% (C) copyright Mogens Blanke 2001-2005
%
version 2.01 November 2005
%
% \qquad input:
% Is satellite inertia
matrix in SBC real(3,3)
% ws satellite’s steaty state angular
velocity (SBC frame) real(3,1)
% hw wheel momentum in SBC frame
real(3,1)
%
% tau_w wheel loop timeconstant scalar(1,1)
[s]
% Include w_bw if you want to calculate the model with wheel
%
dynamics included
% Ts optional sampling time to get a
discrete model
% \qquad\qquad\qquad\qquad the discrete model is calculated
if the Ts parameter is specified
%
% The last two parameters can be ommitted
from the call.
%
% \qquad output:
% \qquad satmod_c statespace model
(Matlab LTI format):
% \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
dx(t)/dt =\qquad A*x(t) + B_u*N_c(t)
% \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
APPENDIX A. PROGRAMME LISTINGS AND CONTENTS CD 41
Aw(:,2)
= [Is(3,1), 2*Is(3,2), (Is(3,3)-Is(2,2));...
-Is(3,2), 0, Is(1,2);...
Is(2,2)-Is(1,1), 2*Is(1,2),-Is(1,3)]*ws;
Aw(:,3)= [-Is(2,1),Is(3,3)-Is(2,2),-2*Is(2,3);...
invrtIs = inv(Is);
Aww = Aw + Ahw;
A = [invrtIs*Aww,
zeros(3,3), invrtIs*Awh;...
0.5*eye(3,3), zeros(3,3), zeros(3,3);...
C = [eye(6,6), zeros(6,3)]; D
= zeros(6,3)
%
case with wheel dynamics included (12 states in state vector)
if (nargin
== 4 | nargin == 5)
A = [invrtIs*Aww, zeros(3,3), invrtIs*Awh, -invrtIs;...
C = [eye(6,6), zeros(6,6)];
D = zeros(6,3);
end
if
(nargin == 5)
satmod_c = SS(A, Bu, C, D, Ts);
end
APPENDIX A. PROGRAMME LISTINGS AND CONTENTS CD 43
A.2 romerEx
function romer_ex
% roemer-like example
% MB 9. nov 2009
%
%
% parameters for plot
re_min = -0.25; re_max = 0.05; im_min=-0.1; im_max = 0.1;
re_axis = 0.9*[re_min, re_max];
im_axis = 0.9*[im_min, im_max];
re_min_zoom = -0.01; re_max_zoom = 0.01;
im_min_zoom=-0.01; im_max_zoom = 0.01;
re_axis_zoom = 0.9*[re_min_zoom, re_max_zoom];
im_axis_zoom = 0.9*[im_min_zoom, im_max_zoom];
% run open and closed loop for ang. velocity wsy and zero angular
% momentum
[satmod_Nw2y_open, satmod_Nd2y_open] = lin_sat_wheels_mod(Is, ws0, hs0);
[P,Z] = pzmap(satmod_Nw2y_open)
figure(1)
pole_zero_plot(P,Z,re_axis, im_axis, limplotvec, ...
’pole zero plot open loop’, ’romex_ws0_hs0_open.eps’)
pole_zero_plot(P,Z,re_axis_zoom, im_axis_zoom,limplotveczoom, ...
’pole zero plot open loop’, ’romex_ws0_hs0_open_zoom.eps’)
[A,B,C,D] = ssdata(satmod_Nw2y_open);
om_bw = 0.2;
Kpd = 2*Is*om_bw;
Kp = Is*om_bw^2;
Ky = [Kpd, 2*Kp];
Kr = -2*[Kp];
D_cl = zeros(size(C,1),size(Kr,2));
APPENDIX A. PROGRAMME LISTINGS AND CONTENTS CD 44
% run open and closed loop for ang. velocity wsy and zero angular
% momentum
[satmod_Nw2y_open, satmod_Nd2y_open] = lin_sat_wheels_mod(Is, ws1, hs0);
[P,Z] = pzmap(satmod_Nw2y_open)
figure(3)
pole_zero_plot(P,Z,re_axis, im_axis, limplotvec, ...
’pole zero plot open loop’, ’romex_ws1_hs0_open.eps’)
pole_zero_plot(P,Z,re_axis_zoom, im_axis_zoom,limplotveczoom, ...
’pole zero plot open loop’, ’romex_ws1_hs0_open_zoom.eps’)
[A,B,C,D] = ssdata(satmod_Nw2y_open);
om_bw = 0.2;
Kpd = 2*Is*om_bw;
Kp = Is*om_bw^2;
Ky = [Kpd, 2*Kp];
Kr = -2*[Kp];
D_cl = zeros(size(C,1),size(Kr,2));
satmod_ref2y_closed = ss(A-B*Ky*C, B*Kr, C, D_cl );
[P,Z] = pzmap(satmod_ref2y_closed)
figure(4)
pole_zero_plot(P,Z,re_axis, im_axis, limplotvec, ...
’pole zero plot closed loop’, ’romex_ws1_hs0_closed.eps’)
pole_zero_plot(P,Z,re_axis_zoom, im_axis_zoom,limplotveczoom, ...
’pole zero plot closed loop’, ’romex_ws1_hs0_closed_zoom.eps’)
% run the example for open and closed loop with wsy and hs1 (angular
% momentum bias)
[satmod_Nw2y_open, satmod_Nd2y_open] = lin_sat_wheels_mod(Is, ws1, hs1);
[P,Z] = pzmap(satmod_Nw2y_open)
figure(5)
pole_zero_plot(P,Z,re_axis, im_axis, limplotvec, ...
’pole zero plot open loop’, ’romex_ws1_hs1_open.eps’)
pole_zero_plot(P,Z,re_axis_zoom, im_axis_zoom,limplotveczoom, ...
’pole zero plot open loop’, ’romex_ws1_hs1_open_zoom.eps’)
om_bw = 0.2;
APPENDIX A. PROGRAMME LISTINGS AND CONTENTS CD 45
Kpd = 2*Is*om_bw;
Kp = Is*om_bw^2;
Ky = [Kpd, 2*Kp];
Kr = -2*[Kp];
D_cl = zeros(size(C,1),size(Kr,2));
satmod_ref2y_closed = ss(A-B*Ky*C, B*Kr, C, D_cl );
[P,Z] = pzmap(satmod_ref2y_closed)
figure(6)
pole_zero_plot(P,Z,re_axis, im_axis, limplotvec, ...
’pole zero plot closed loop’, ’romex_ws1_hs1_closed.eps’)
pole_zero_plot(P,Z,re_axis_zoom, im_axis_zoom,limplotveczoom, ...
’pole zero plot closed loop’, ’romex_ws1_hs1_closed_zoom.eps’)
end
A.3 SATsimstart
% script file to test Simulink satellite simulation
%
(C) copyright Mogens Blanke 2001-2003
% version 03a December 2003
%
global
fpc_gain;
global fpc_flag;
global fpc_param;
global fpc_state;
global time;
%
initialize all simulation parameters
SAT_sim; RWA_sim;
% FPC_sim;
%
AD_sim;
% start simulation % in front of the line you don’t want !
sat3_sim
A.4 RWAsim
% RWAsim
% This script initializes your wheel model.
%
It enables different number of wheels and orientations by
% selecting
the parameters Awar, w-w_ini and N_dw.
% Number of columns in Awar MUST
equal number of wheels
% Wheel initial velocity is specified in w_w_ini
%
N_dw specifies the torque demand of each wheel
% n_w specifies the number
of wheels
%
% Note: # columns in Awar == dim(w_w_ini) == dim(N_dw) ==
n_w
APPENDIX A. PROGRAMME LISTINGS AND CONTENTS CD 47
%
% (C) Copyright 2001-2003 Mogens Blanke, DTU
% version 03a December
2003
%
% Parameters for each wheel
% Example 2: 3 wheels
in orthogonal orientation
n_w = 3; a = 1;
Awar = [a 0 0; 0 a 0; 0 0 a ]’;
w_w_ini
= [100, 100, 100];
%
Remember to put % in front of lines for the cases you don’t use
APPENDIX A. PROGRAMME LISTINGS AND CONTENTS CD 48
A.5 SATsim
% SATsim
% script to initialize satellite main body
parameters
Iscb = diag([3,14,15]);
Tsamp = 1.0;