0% found this document useful (0 votes)
102 views

Satellite Attitude Control With Frequency Domain

This document summarizes a lecture on applying frequency domain techniques to design a simple attitude control system for a flexible satellite modelled as two rigid bodies connected by a spring. It presents the satellite model as two bodies connected by a torsional spring and damper, with a flywheel torque input acting on the smaller body. It derives the state space model and presents the A, B, C, and D matrices of the four state system with inputs, outputs of body and payload rates and positions. Feedback control approaches are discussed to control the flexible satellite system in the frequency domain.

Uploaded by

Pythonraptor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views

Satellite Attitude Control With Frequency Domain

This document summarizes a lecture on applying frequency domain techniques to design a simple attitude control system for a flexible satellite modelled as two rigid bodies connected by a spring. It presents the satellite model as two bodies connected by a torsional spring and damper, with a flywheel torque input acting on the smaller body. It derives the state space model and presents the A, B, C, and D matrices of the four state system with inputs, outputs of body and payload rates and positions. Feedback control approaches are discussed to control the flexible satellite system in the frequency domain.

Uploaded by

Pythonraptor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

6/22/2020 Practicon Exercise System TU Delft

Lecture 12
ae2204 Aerospace Systems and Control Theory
With answers and notes by Anthony Cummins (4436253)

Satellite attitude control with frequency domain


Introduction
Welcome to this e-learning lecture. This lecture replaces one of my former ``live'' lectures. In this lecture we
will be applying frequency domain design techniques to the design of a simple (single axis) satellite attitude
control problem.
To make things a bit more interesting, we will be using a model of a flexible satellite. After all, sending
Sputnik-sized objects into space today is hardly commercially viable, satellites need large solar arrays and
sometimes large antennas to perform their functions. At the same time, people try to send up as little
(structural) mass as possible, which makes that the satellite has about the stiffness of a paper airplane, or
worse.

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 1/32
6/22/2020 Practicon Exercise System TU Delft

HALCA radio astronomy satellite

Skynet, a millitary communications satellite.

To keep things a bit limited, however, we only look at control around a single orientation axis, and we limit the
multi in multi-body modelling to two.

This results in a system consisting of two rigid bodies, connected by a (torsion) link that can be modelled as a
spring with little damping. The following picture gives the system:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 2/32
6/22/2020 Practicon Exercise System TU Delft

Parameters for our model are:

Inertia body Jb = 400 [kg m ]


2

Inertia payload Jp = 1000 [kg m ]


2

Link stiffness k = 10 [Nm rad


−1
]

Link damping b = 5 [Nms rad


−1
]

We assume that we can exert a torque on the satellite with a flywheel, so the control input to the system is a
torque on the satellite body (with the small intertia). In general, the payload (the antenna, in case of the
HALCA satellite), has to be oriented. Below an example of such a flywheel:

We start off by creating a (state-space) model for the satellite.

For the modelling, we will start by translating the satellite problem into a block diagram first. The satellite is
modelled by two rigid bodies, each with their own moment of inertia, and connected with a torsional spring
and a torsional damper. A flywheel, which we assume to be a perfect and infinitely fast torque generator, is
attached to the satellite body.

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 3/32
6/22/2020 Practicon Exercise System TU Delft

The parameters are:

Inertia body Jb = 400 [kg m ]


2

Inertia payload Jp = 1000 [kg m ]


2

Link stiffness k = 10 [Nm rad


−1
]

Link damping b = 5 [Nms rad


−1
]

Consider the following block diagrams, and select the one correct ones.

Your answer

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 4/32
6/22/2020 Practicon Exercise System TU Delft

The model answer

Explanation / script

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 5/32
6/22/2020 Practicon Exercise System TU Delft

Feedback
Very good, a perfect score. Keep up the good work.
The correct block diagram is:

The first block 1/(Jb s2 ) represents the inertia of the satellite body. Two moments are acting on this inertia:
the moment exerted by the torque wheel (T ) is the first. The second is the moment from the link with the
other (payload) body part.

The spring moment exerted by the body on the payload will be

k(θb − θp )

The moment contribution from the damper will likewise be

˙ ˙
b(θb − θp )

This can be converted to the laplace domain, and taking the total moment in the link:

k(θb − θp ) + bs(θb − θp )

This calculation takes place in the second block. The signal entering this block is the difference between the
rotation of the two bodies: θb − θp . Barring any influence from outside actors, this is also the total moment
exerted on the payload.

The payload transfer function 1/(Jp s2 ) , is a mirror of the body transfer function, describing the payload
attitude as a consequence of the moment acting on the payload inertia.

The next step is to create a model or Matlab for the satellite. We will be analysing the model behaviour in the
frequency domain, look at time-domain responses, try different feedback approaches and look at both
payload and body speed and attitude. A model with multiple inputs and multiple outputs is needed, so like in
the exercise on the autopilot altitude hold mode, a state-space model is called for.

Let's build up the model by assembling the sub-systems, and then connecting all feedback loops, using the
Matlab connect call or the Scilab feedback operator. Consider the full block diagram below:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 6/32
6/22/2020 Practicon Exercise System TU Delft

Here, the moment contributions from the spring and the damper have been split out again. First, enter the
unconnected blocks into Matlab, like this:

Jb = 400;
Jp = 1000;
k = 10;
b = 5;
s = tf('s');
hb1 = 1/(Jb*s);
hb2 = 1/s;
hp1 = 1/(Jp*s);
hp2 = 1/s;
sat0 = append(ss(hb1), ss(hb2), k, b, ss(hp1), ss(hp2));

Now, I leave it up to you to properly connect these pieces, trim off all unnecessary inputs, and obtain a system
with:

One input, the torque T .


Four outputs, θ˙ b , θb , θ˙ p , θp

Since you could skip this part of E-lecture 8, it might be that you do not know how to proceed here. To help
you, the following "hint" presents the solution.

Your answer
Enter the A, B, C and D matrices of your system model
A = [ -0.0125 -0.6250 0.0100 0.6250; 0.0400 0 0 0; 0.0063 0.3125 -0.0050
-0.3125; 0 0 0.0320 0 ]

B = [0.0625; 0; 0; 0 ]

C = [ 0.0400 0 0 0; 0 1.0000 0 0; 0 0 0.0320 0; 0 0 0


1.0000 ]

D = [0; 0; 0; 0 ]

The model answer


https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 7/32
6/22/2020 Practicon Exercise System TU Delft

Enter the A, B, C and D matrices of your system model


A = [ -0.0125, -0.5, 0.0079056942, 0.5;
0.05, 0.0, 0.0, 0.0;
0.0079056942, 0.31622777, -0.005, -0.31622777;
0.0, 0.0, 0.031622777, 0.0 ]

B = [ 0.05;
0.0;
0.0;
0.0 ]

C = [ 0.05, 0.0, 0.0, 0.0;


0.0, 1.0, 0.0, 0.0;
0.0, 0.0, 0.031622777, 0.0;
0.0, 0.0, 0.0, 1.0 ]

D = [ 0;
0;
0;
0]

Explanation / script
Jb = 400;
Jp = 1000;

Used or unused hints


unused Basically, the solution is here. 9 pts
To enter the satellite, use the connect function. The following are all data you need to call this function,
just check its help text to see how to exactly call it.

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 8/32
6/22/2020 Practicon Exercise System TU Delft

%% Two-body satellite, with flexible link


%% attitude sensor and actuator are on the small-inertia body
%% basic parameters
Jb = 400;
Jp = 1000;
k = 10;
b = 5;
%% transfer functions body elements
s = tf('s');
hb1 = 1/(Jb*s);
hb2 = 1/s;
hp1 = 1/(Jp*s);
hp2 = 1/s;
sat0 = append(ss(hb1), ss(hb2), k, b, ss(hp1), ss(hp2));
%% connection of the elements with connect call
Q = [ 1 -3 -4; ... % link moment (spring, damper), feedback to body
2 1 0; ... % link integrator to body velocity
3 2 -6; ... % spring input, th_b - th_p
4 1 -5; ... % damper input
5 3 4; ... % link moment, acting on payload
6 5 0];
inputs = [1];
outputs = [1 2 5 6];

Python variant

from control.matlab import tf, ss, append, connect

Jb = 400;
Jp = 1000;
k = 10;
b = 5;
s = tf([1, 0], [1]);
hb1 = 1/(Jb*s);
hb2 = 1/s;
hp1 = 1/(Jp*s);
hp2 = 1/s;
sat0 = append(ss(hb1), ss(hb2), k, b, ss(hp1), ss(hp2));

# connection of the elements with connect call


Q = [[1, -3, -4], # link moment (spring, damper), feedback to body
[2, 1, 0], # link integrator to body velocity
[3, 2, -6], # spring input, th_b - th_p
[4, 1, -5], # damper input
[5, 3, 4], # link moment, acting on payload
[6, 5, 0]]
inputs = [1];
outputs = [1, 2, 5, 6];
sat1 = connect(sat0, Q, inputs, outputs);

Feedback
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 9/32
6/22/2020 Practicon Exercise System TU Delft

Very good, a perfect score. Keep up the good work.

It is all a question of bookkeeping. Keep in mind in which order the systems are entered in the combined
system, and carefully connect everything. Let's start with the Matlab version, the base system was entered
as:

%% Two-body satellite, with flexible link


%% attitude sensor and actuator are on the small-inertia body
%% basic parameters
Jb = 400;
Jp = 1000;
k = 10;
b = 5;
%% transfer functions body elements
s = tf('s');
hb1 = 1/(Jb*s);
hb2 = 1/s;
hp1 = 1/(Jp*s);
hp2 = 1/s;
sat0 = append(ss(hb1), ss(hb2), k, b, ss(hp1), ss(hp2));

Then the connection between the difference model parts is made:

%% connection of the elements with connect call


Q = [ 1 -3 -4; ... % link moment (spring, damper), feedback to body
2 1 0; ... % link integrator to body velocity
3 2 -6; ... % spring input, th_b - th_p
4 1 -5; ... % damper input
5 3 4; ... % link moment, acting on payload
6 5 0];
inputs = [1];
outputs = [1 2 5 6];
sat1 = connect(sat0, Q, inputs, outputs);

Python variant

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 10/32
6/22/2020 Practicon Exercise System TU Delft

from control.matlab import tf, ss, append, connect

Jb = 400;
Jp = 1000;
k = 10;
b = 5;
s = tf([1, 0], [1]);
hb1 = 1/(Jb*s);
hb2 = 1/s;
hp1 = 1/(Jp*s);
hp2 = 1/s;
sat0 = append(ss(hb1), ss(hb2), k, b, ss(hp1), ss(hp2));

# connection of the elements with connect call


Q = [[1, -3, -4], # link moment (spring, damper), feedback to body
[2, 1, 0], # link integrator to body velocity
[3, 2, -6], # spring input, th_b - th_p
[4, 1, -5], # damper input
[5, 3, 4], # link moment, acting on payload
[6, 5, 0]]
inputs = [1];
outputs = [1, 2, 5, 6];
sat1 = connect(sat0, Q, inputs, outputs);

With these models, we will start to analyse the satellite's behaviour and design and tune controllers.

Your notes:
Q matrix elements represent the subscripts on inputs and outputs.

Before we start off with controlling the satellite, let us first inspect the thing without controller. There are
several things we can do to understand what we are dealing with. The first step would be to create transfer
functions for the system's body attitude (the one we are measuring and using for feedback) and payload
attitude (the one we wat to actually control), and inspect those.

Another thing to try would be to apply a familiar input signal, let's take a step input here, and see what the
output is. Apply a unit step input to the system, and plot the two velocities θ˙ b and θ˙ p , taking a 100 second
time span (the satellite is not that fast!). Check the statements that are true from the following list.

Note that (but check this) the Python version of the step command gives you only one output signal

Your answer
Mark the statements that are true
After 100 seconds, the payload will have a higher rotational speed than the satellite body
After 100 seconds, the payload will have rotated more than the body
The satellite transfer functions for the payload attitude response to the torque input is a type 2 system
The satellite transfer functions for the payload attitude response to the torque input is a type 0 system
The satellite transfer functions for the payload attitude response to the torque input is a type 1 system
Fill in the following results
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 11/32
6/22/2020 Practicon Exercise System TU Delft

What is the damping coefficient of the pair of complex poles in the transfer
function that describes the rotation of the satellite body in response to 0.0468
torque input
What is the absolute value of the largest difference in rotation between the
0.1331
payload and the body

The model answer


Mark the statements that are true
After 100 seconds, the payload will have a higher rotational speed than the satellite body
After 100 seconds, the payload will have rotated more than the body
The satellite transfer functions for the payload attitude response to the torque input is a type 2 system
The satellite transfer functions for the payload attitude response to the torque input is a type 0 system
The satellite transfer functions for the payload attitude response to the torque input is a type 1 system
Fill in the following results
What is the damping coefficient of the pair of complex poles in the transfer
function that describes the rotation of the satellite body in response to 0.046770717
torque input
What is the absolute value of the largest difference in rotation between the
0.13308641
payload and the body
Explanation / script
%electure 12

Feedback
Very good, it is perfect now. Keep up the good work.

Well, I hope you have seen in creating the step response plots, and in analysing the transfer function, that the
satellite has a pair of pretty badly damped poles. An ``abrupt'' input, such as the step input we tested the
satellite with, introduces an oscillation in the satellite that takes hundreds of seconds to quiet down again. We
will proceed to create an attitude controller for the satellite, and see that this oscillation severely limits the
options for this attitude controller (and after that, we explore a fix).

For those of you who did not succeed in getting the answers to the questions right, here is the Matlab script
for inspecting the open-loop system:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 12/32
6/22/2020 Practicon Exercise System TU Delft

% transfer function, torque on body to body attitude


Hb = minreal(tf([0 1 0 0]*sat1))
% transfer function, torque on body to payload attitude
Hp = minreal(tf([0 0 0 1]*sat1))
% calculate a step input, and plot the speeds
t = 0:0.05:100;
y = lsim(sat1, ones(size(t)), t);
% plot the two velocities
clf; plot(t', y(:,[1 3]))
% absolute maximum difference
max(abs(y(:,2)-y(:,4)))

And here the Python version

from control.matlab import step, damp


import scipy as sp
import matplotlib.pyplot as plt

# given the satellite model, calculate the response


t = sp.arange(0, 100.1, 0.1)
y, t = step(sat1, t)
plt.plot(t, y[:,1], t, y[:,3])
plt.show()

# largest difference in angles


print(sp.absolute(y[:,1] - y[:,3]).max())

# calculate damping
damp(sat1)

We proceed with tuning a feedback controller using frequency domain techniques.

Now that the basic system is in Matlab, and we have seen its properties, let's work a bit more on getting an
attitude control for this device.

You have seen that the basic system is a type 2 system. On the one hand this is nice; you know that if you
create the proper controller and give the system a ramp (constant rotation speed) to track, it will do so with
zero steady-state error. However, the problem this creates become clear when you plot the transfer function
(take torque input to payload position) in a Bode plot. A reasonable range for this (it is a slow system after all)
would be from 0.001 to 1[rad s−1 ].

Assuming we can measure the attitude of the payload, we will use this measurement to controll the torque
wheel that is on the sattelite body. As you can see from the Bode plot, there is no region where the open-loop
system has a positive phase margin.

Assuming that the attitude rate of the payload can also be measured (e.g. with a rate gyro), a PD controller
can be applied:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 13/32
6/22/2020 Practicon Exercise System TU Delft

The transfer function of the PD controller is:

GP D (s) = Kp (1 + Kd /Kp s)

The ratio Kd /Kp is taken to be 50, to tune the compensating network. Create a Bode plot for the
combination of this network (initially take Kp = 1 ) and the open-loop satellite dynamics, and verify that there
is indeed a region with positive phase margin.

Your answer
How high is the resonance peak (in dB), near 0.03 Hz / 0.19 rad/s, for
combination of transfer functions of the compensator and the payload 6.3
attitude response
What value do you need to give Kp to have a gain margin of 6 dB for the
-12.3
open loop system with compensator?
For the value of Kp in the sub-question above, what will be the phase
80
margin (in degrees) of the open-loop system?
What will be the cross-over frequency in radians corresponding to that
36
gain?

The model answer


How high is the resonance peak (in dB), near 0.03 Hz / 0.19 rad/s, for
combination of transfer functions of the compensator and the payload 6.3209034
attitude response
What value do you need to give Kp to have a gain margin of 6 dB for the
0.24207772
open loop system with compensator?
For the value of Kp in the sub-question above, what will be the phase
36.300726
margin (in degrees) of the open-loop system?
What will be the cross-over frequency in radians corresponding to that
0.014693255
gain?
Explanation / script

Feedback

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 14/32
6/22/2020 Practicon Exercise System TU Delft

As you can see, there are not many possibilities with the badly damped oscillation in the satellite link ``in the
way''. To have only a small gain margin in the open-loop system (and you need that, otherwise the satellite
with the controller will form an unstable closed-loop system), the gain Kp must be tuned way down, to Kp =
0.24. This means that the cross-over frequency will also be low, and the gain margin is also pretty small.

You can put the ``corner frequency'' of the compensator even lower, but that cranks up the gain near the
oscillation even further. Another option would be to add a lag to the compensator, and only provide phase
margin in a small region. However, in the following we will explore the use of a notch filter, as a means to get
rid of this pesky oscillation!

To get to the proper combined transfer function for the compensator and the open-loop payload attitude
response to torque input, and then plot it, the following Matlab commands can be used:

%% get the payload transfer function again


Hp = minreal(tf([0 0 0 1]*sat1))
%% Bode plot, open loop system
%% phase might start at +180, but that does not mean
%% we have a very large phase margin, it is just an
%% artefact of the program (+180 deg = -180 deg)
clf; bode(Hp, {0.001, 1})
%% Combine with the compensator
HpHc = (1+50*s)*Hp
%% Bode plot, again
clf; bode(HpHc, {0.001, 1})
%% find maximum phase -101 deg, means a margin of 79 deg
%% however, the gain peak is at +6.3 dB,
%% to tune to have a gain margin of 6 dB, a gain of -12.3 dB
%% (=10^(-12.3/20) = 0.243)
%% needs to be added.
%% re-plot, with gain
clf; margin(0.243*HpHc)
%% at the 0dB crossing, the phase is -144, meaning that the
%% phase margin will be 36 degrees.
%% the cross-over frequency is 0.0025 Hz or 0.015 rad/s

Python version:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 15/32
6/22/2020 Practicon Exercise System TU Delft

# system, Python does not need a minreal here


Hp = tf(sp.matrix([0, 0, 0, 1])*sat1)

# with controller
s = tf([1, 0], [1])
HpHc = Hp * (1+50*s)

# do a Bode plot
bode([HpHc], omega=sp.logspace(-3, 0, 500))
plt.show()

# zoom in on the resonance peak to read off the value


# get a gain of approx 2.07, equivalent to a gain in dB of
print(20 * sp.log10(2.07))

# a gain margin of 6 dB means a gain of


print(10.**(-6./20.))
# so gain needs to be reduced by
print(10.**(-12.3/20.))

# verify with margin


print(margin(0.24266*HpHc))

problems are also evident if you plot the closed-loop transfer function in a Bode plot, or when looking at the
step response of the controller. The following figure shows the step response of the closed-loop system:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 16/32
6/22/2020 Practicon Exercise System TU Delft

Two problems are evident. The system has a slow oscillation, with a faster oscillation on top. The slow
oscillation is related to the moderate phase margin of the closed-loop system, the faster oscillation is related
to the moderate gain margin.

Instead of a flat frequency response over a wide region, and then a drop in response, the Bode plot of the
closed-loop system clearly shows the effect of the small gain margin near the oscillation peak.

Notch filters
It may be clear that the oscillation is a problem for the control of the satellite. One solution is to send up more
material; making the link between the two satellite parts stiffer and better damped. However, that may be a
costly solution, and some more work on the controller might be just as effective.

Remember how a frequency response for a transfer function is calculated; one can fill in s = jω for the
parameters of the transfer function, and the magnitude of the complex numbers obtained for the different ω is
the gain of the sine response, while the angle of the complex number is the phase difference of the sine
response (see the slides for lecture~8).

To understand the relationship between the poles and zeros of a transfer function, and the frequency
response a bit better, write the transfer function in the following form:

N (s) (s − z1 ) … (s − zn )
H (s) = K = K
D(s) (s − p1 ) … (s − pn )

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 17/32
6/22/2020 Practicon Exercise System TU Delft

As an example, I have the following transfer function for you, with poles at p1,2 = −0.5 ± 1i and zeros at
z1,2 = −0.5 ± 2i :

(s + 0.5 + 2i)(s + 0.5 − 2i)


H (s) =
(s + 0.5 + i)(s + 0.5 − i)

What happens as we calculate the frequency response? Just fill in s = iω. But what does that mean?s = iω

is a point on the positive imaginary axis, and s − p1 can be seen as a vector, starting in p1 and ending on
that point s = iω. As we traverse the frequency ω , the length of the vector s − p1 will change. I depicted
this in comic-book style:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 18/32
6/22/2020 Practicon Exercise System TU Delft

The solution to the problem with the flexible satellite link is based on this knowledge. You create a transfer
function with a pair of zeros in the complex plane, near the frequencies you want to suppress, so near
s = ωno i and s = −ωno i. This type of filter is called a notch filter, since it ``carves'' a notch into the

frequency response.

A transfer function with only zeros, and without poles, will not be realizable, meaning that it cannot be
implemented with physical components. To make a notch filter practical, it will need at least as many poles as
zeros. The pole locations need to be chosen so that the poles' contribution to the frequency response does
not interfere with the controller.

Looking at notch filters


The notch filter we are going to use has two poles and two zeroes, and the poles and zeroes only differ in
damping coefficient, resulting in a filter of the following shape:

2
1 + 2ζ1 s/ωno + (s/ωno )
Hno (s) =
2
1 + 2ζ2 s/ωno + (s/ωno )

The choices for the damping coefficients ζ1 and ζ2 influence the behaviour of the notch filter. To get a feel for
these filters, first implement it for a frequency ωno = 10(2π) [rad s−1 ], so, for 10[Hz]. Take ζ1 = 0.0 and
ζ2 = 0.7 , and implement the filter in Matlab.

One other application of notch filters is to smoothe the signals that are generated by D/A (digital to analog)
converters. For example the SIMONA research simulator uses notch filters on its commanded position input.
The commanded position for the simulator is driven by the simulation model, and changes 100 times per
second. After it changed, it is constant for 10 ms, creating a type of staircase signal. If that signal is applied to
the simulator directly, the simulator motion will not be smooth, but slightly rough, with an added vibration that
is also audible as a hum. One can see the staircase as a ramp with an added saw-tooth signal, which can be
de-composed as an infinite series of sines, starting with 100 Hz sine, and then smaller 200 Hz, 300 Hz, etc.,
components. The notch filter in the SIMONA research simulator filters out the 100 Hz component, and is
combined with a low-pass filter to get the higher-frequency (200 Hz and beyond) components out.

Now let's play with the 10 Hz notch filter. Create a staircase signal with 0.1 s intervals; in Matlab:

% staircase input
t = 0:0.001:0.5;
u = t - mod(t, 0.1);

If you are a Python user:

import numpy as np
t = np.arange(0, 0.5, 0.001)
u = t - np.mod(t, 0.1);

Play around with the 10 Hz notch filter, create a Bode and a Polar/Nyquist plot and calculate and plot the
response to the staircase signal. Answer the following questions:

Your answer

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 19/32
6/22/2020 Practicon Exercise System TU Delft

Plot the staircase response, and answer:


What is the value of the response to the staircase input at time t = 0.11 0.0439
Plot the Bode plot, and answer:
What is the lower bound (in rad/s) of the frequency region where the gain
49.3
of the notch filter is lower than -10 dB?
What is the upper bound (in rad/s) of the frequency region where the gain
79.1
of the notch filter is lower than -10 dB?
Plot the Nyquist plot, and determine what the shape of the frequency response is in the Nyquist plane:
In the Nyquist plot, the frequency response looks like a square.
In the Nyquist plot, the frequency response looks like a circle.
The resulting shape in the Nyquist plot is quite complex, and cannot be simply described

The model answer


Plot the staircase response, and answer:
What is the value of the response to the staircase input at time t = 0.11 0.043946289
Plot the Bode plot, and answer:
What is the lower bound (in rad/s) of the frequency region where the gain
49.920383
of the notch filter is lower than -10 dB?
What is the upper bound (in rad/s) of the frequency region where the gain
79.118475
of the notch filter is lower than -10 dB?
Plot the Nyquist plot, and determine what the shape of the frequency response is in the Nyquist plane:
In the Nyquist plot, the frequency response looks like a square.
In the Nyquist plot, the frequency response looks like a circle.
The resulting shape in the Nyquist plot is quite complex, and cannot be simply described
Explanation / script
% staircase input
t = 0:0.001:0.5;

Feedback
Very good, a perfect score. Keep up the good work.
As you could see, the notch filter suppresses signals in a narrow frequency band. The response to the
staircase signal looks peculiar, and more ``spiky'' than the original staircase signal, however, the base
frequency of the staircase signal (10 Hz, in the example, has been removed.

The scripts for creating the plots are, in Matlab:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 20/32
6/22/2020 Practicon Exercise System TU Delft

% staircase input
t = 0:0.001:0.5;
u = t - mod(t, 0.1);
% Notch filter
s=tf('s');
w = 10*2*pi;
z1 = 0;
z2 = 0.7;
Hno = (1+2*z1/w*s+s^2/w^2)/(1+2*z2/w*s+s^2/w^2);
% make time response and a plot
y = lsim(Hno, u, t);
figure(1); clf(); plot(t,y)
% plot a Bode diagram
figure(2); clf(); bode(Hno);
% plot a Nyquist diagram
figure(3); clf(); nyquist(Hno);

And now in Python

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 21/32
6/22/2020 Practicon Exercise System TU Delft

# imports
from control.matlab import tf, \
bode, lsim, nyquist
import matplotlib.pyplot as plt
import scipy as sp

# staircase input
t = sp.arange(0, 0.5, 0.001)
u = t - sp.mod(t, 0.1);

# 10 Hz notch filter
s = tf([1, 0], [1])
wno = 10*2*sp.pi
z1 = 0
z2 = 0.7
Hno = (1+2*z1/wno*s+s**2/wno**2)/(1+2*z2/wno*s+s**2/wno**2)

# time response
y, t, x = lsim(Hno, u, t)
f1 = plt.figure()
plt.plot(t, y)

# the required value


print(y[t == 0.11])

# bode plot
f2 = plt.figure()
mag, phase, omega = bode(Hno, sp.logspace(1, 2, 500))

# and a Nyquist plot


f3 = plt.figure()
nyquist(Hno, sp.logspace(0, 3, 500))
plt.show()

# what is -10 db in gain?


tendb = 10**(-10./20)

# get these frequencies. Note that the answer gets more precise with a
# sufficiently large logspace vector over a not too wide range
print(omega[mag < tendb][0], omega[mag < tendb][-1])

Open loop with notch filter


Look again at the formulation of the notch filter:

2
1 + 2ζ1 s/ωno + (s/ωno )
Hno (s) =
2
1 + 2ζ2 s/ωno + (s/ωno )

The oscillatory peak in the satellite's transfer function is at 0.187 rad/s. To show that the notch filter also works
if it is slightly out of tune (after all, we cannot perfectly predict the flexibility), take a frequency
ωno = 0.19 [rad/s] for the notch filter. We also take the damping coefficient to match more or less the

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 22/32
6/22/2020 Practicon Exercise System TU Delft

coefficient of the oscillation in the satellite, so ζ1 = 0.05 , and take ζ2 = 0.7 . Enter the transfer function for
the notch filter.

Now take the same PD controller as before:

GP D (s) = Kp (1 + Kd /Kp s)

With a time constant τP D = Kd /Kp = 50 [rad/s] .

Create the open-loop transfer function for the combination of the controller, the notch filter and the satellite
model:

Create a Bode plot, using Kp = 1 , analyse, and answer the following questions:

Your answer
What is the cross-over frequency (in rad/s) 0.04

What is the phase margin (in degrees) 47.5

What is the current gain margin (in dB)? 14.7

The model answer


What is the cross-over frequency (in rad/s) 0.039994292

What is the phase margin (in degrees) 47.501048

What is the current gain margin (in dB)? 14.721354


Explanation / script

Feedback
Very good, a perfect score. Keep up the good work.
I hope you agree that the Bode plot for the open loop looks a lot nicer than the one without the notch filter.
The difference is even more clear if you plot the frequency response in a polar plot. The following graph
shows the frequency response for the open-loop system without the notch filter:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 23/32
6/22/2020 Practicon Exercise System TU Delft

If you add the notch filter, the ``wart'' created by the badly damped oscillation nicely disappears, leaving only
a small wiggle, because the notch filter and the oscillation are not exactly matched:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 24/32
6/22/2020 Practicon Exercise System TU Delft

The Matlab script to create the open-loop transfer function and a bode plot is given here:

%% get the basic satellite model


basemodel
%% We need the transfer function from torque input to payload attitude:
Hp = minreal(tf([0 0 0 1]*sat1))
%% Enter the notch filter
s = tf('s')
w_no = 0.19;
z1_no = 0.05;
z2_no = 0.7;
Hno = (1+2*z1_no*s/w_no+s^2/w_no^2)/(1+2*z2_no*s/w_no+s^2/w_no^2);
%% Combine and add the PD controller
tau_PD = 50;
Hopen = (1+tau_PD*s)*Hno*Hp
bode(Hopen)

And in Python the following procedure gives you the answers

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 25/32
6/22/2020 Practicon Exercise System TU Delft

# matched notch filter


s = tf([1, 0], [1])
wno = 0.19
z1 = 0.05
z2 = 0.7
Hno = (1+2*z1/wno*s+s**2/wno**2)/(1+2*z2/wno*s+s**2/wno**2)

# the controller, Kp = 1 for now


Kp = 1
tau_PD = 50
Hc = (1 + tau_PD*s)*Kp

# start with the basic satellite model sat1, and get the
# payload attitude response
Hp = tf(sp.matrix([0, 0, 0, 1])*sat1)

# total open loop


Hol = Hc*Hno*Hp

# bode plot
bode(Hol, sp.logspace(-2, 0, 500))
plt.show()

# calculate margins. Gain is given as such, so re-calculate


# to dB
gm, pm, wg, wp = margin(Hol)
print(wp, pm, 20*sp.log10(gm))

# always check the margins, and compare with the Bode plot. Sometimes the margins are
# not correctly found (the above may yield a phase margin of at frequency 0, while the
# phase does not cross -180, but simply starts at -180 for frequency -> 0. In that case
# zoom in and read off from the plot

Tuning
Now it is time to tune the controller. Select a gain for Kp to achieve the highest cross-over frequency that
yields a phase margin of at least 47 degrees and a gain margin of at least 10 dB.

As a reminder, here is the control loop again:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 26/32
6/22/2020 Practicon Exercise System TU Delft

With time constant τP D = Kd /Kp =50 [rad/s] , the notch damping coefficients ζ1 = 0.05 and ζ2 = 0.7 ,
notch natural frequency ωno = 0.19 [rad/s] .

Your answer
Which criterion whas decisive for tuning the controller
The controller was tuned to comply with the phase margin requirement, after tuning, the gain margin
is larger than required.
The controller was tuned to comply with the gain margin requirement, after tuning the phase margin is
larger than required.
The requirements for both margins were equally critical, after tuning, the phase and gain margins both
exactly comply with the requirements.

What gain do you choose for Kp 1.67

The model answer


Which criterion whas decisive for tuning the controller
The controller was tuned to comply with the phase margin requirement, after tuning, the gain margin
is larger than required.
The controller was tuned to comply with the gain margin requirement, after tuning the phase margin is
larger than required.
The requirements for both margins were equally critical, after tuning, the phase and gain margins both
exactly comply with the requirements.

What gain do you choose for Kp 1.6347575


Explanation / script

Feedback
I like that. Keep up the good work.
It appeared that the phase margin was decisive in tuning the system. When tuned with a gain Kp =1.63, the
phase margin becomes 47 degrees, and the gain margin is still 10.5~[dB]. Note that without the notch filter we
had a very small gain margin for the open-loop system.

You can basically use the scripts from the previous question. Inspect the Bode plot (phase part) to see where
the phase crosses 47-180 = -133 degrees, and check the gain (in the gain plot) at that same frequency. The
gain there is approximately 0.61, or -4.29 dB. Increasing the gain by 1/0.61 (4.29 dB) puts the gain cross-over
here. I advise you to always check that; re-enter the controller with the new gain, and use the margin
command to check the margins.

We will proceed with checking the closed-loop properties of the system with this tuning.

Final check
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 27/32
6/22/2020 Practicon Exercise System TU Delft

Now it is time to check the performance of the system. The gain and phase margins used in tuning the open
loop indicate that the system will have limited overshoot this time. The system is also a type 2 system (two
poles in the origin), and we expect this system to be able to follow a ramp-shaped input signal. So, let us
create the closed-loop system, and check the closed loop Bode plot, the response to a step input and the
response to a ramp input. Take a time span of 250~[s] for the time response plots, and answer the following
questions:

Your answer
How large (in %) is the overshoot in response to a step input? 30.1

What is the value of the response to a unit ramp input at t = 250 [s] 0.9987
How large, in dB, is the resonance peak of the closed-loop frequency
0
response?
What is the bandwidth, in Hz, (with a -3 dB criterion) of the closed-loop
0.02
frequency response?
What is the damping coefficient ζ of the dominant pair of poles of the
1
closed-loop system?

The model answer


How large (in %) is the overshoot in response to a step input? 29.954216

What is the value of the response to a unit ramp input at t = 250 [s] 250.00385
How large, in dB, is the resonance peak of the closed-loop frequency
2.6151723
response?
What is the bandwidth, in Hz, (with a -3 dB criterion) of the closed-loop
0.02
frequency response?
What is the damping coefficient ζ of the dominant pair of poles of the
0.97244716
closed-loop system?
Explanation / script

Feedback
Here is the Matlab code to solve this question:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 28/32
6/22/2020 Practicon Exercise System TU Delft

% I assume that here you still have the basic satellite model
% Let us call it sat1, and the notch filter Hno
% The transfer function to get the payload attitude
Hp = minreal(tf([0 0 0 1]*sat1))
%% Enter the notch filter (again)
s = tf('s')
w_no = 0.19;
z1_no = 0.05;
z2_no = 0.7;
Hno = (1+2*z1_no*s/w_no+s^2/w_no^2)/(1+2*z2_no*s/w_no+s^2/w_no^2);
% the open loop system was:
tau_PD = 50;
Hopen = 1.63*(1+tau_PD*s)*Hno*Hp
% for the closed-loop system, create a unit feedback loop
Hclosed = feedback(Hopen, 1)
% calculate a step response, it is a slow system, so
t = 0:0.1:250;
y = step(Hclosed, t);
% check with a plot
plot(t, y)
% ends at one, so the overshoot is
(max(y) - 1)*100
% a unit ramp input. Can create the ramp as 1/s* step
yr = step(Hclosed/s, t);
yr(t == 250)
% bode plot and resonance peak, inspect with data cursor
bode(Hclosed)
% figure out bandwidth
bandwidth(Hclosed)
% note that it has to be supplied in Hz
0.125/2/pi
% damping coefficient, pick the right components
damp(Hclosed)

As expected, the steady-state position error (error to a step) and the steady-state velocity error for this system
both go to 0. The overshoot to a θr step is a little high, however. It is higher than could be expected for a
second order system with a damping coefficient of ζ =0.97. This is a consequence of the choice for a PD
controller; the time constant of the PD controller introduces a zero at -0.02. This zero provides the additional
``kick'' (see the sheets of Lecture 7) in response to the step input.

The control structure that we chose for the satellite controller is given below:

An alternative control structure is given in the following figure:

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 29/32
6/22/2020 Practicon Exercise System TU Delft

You may verify that this structure results in the same poles for the closed-loop system, but does not have the
zero at -0.02. In Matlab:

% assume we have the transfer function for the satellite


Hp
% and the transfer function for the notch filter
Hno
% the feedback parameters are:
Kp = 1.63
tau = 50
s = tf('s')
% create the feedback
Hc = feedback(Kp*Hno*Hp, 1+tau*s)

Try to check the step response of this system, and you will see that the large overshoot is gone. This control
structure does have a disadvantage. You will discover it when you determine the velocity error for your
satellite attitude control.

Here are the scripts in Python version

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 30/32
6/22/2020 Practicon Exercise System TU Delft

# create the closed-loop system, assuming the open-loop one


# from the previous question is still available
# Note: the one with the gain 1.63
from control.matlab import step, damp, bode, lsim
import matplotlib.pyplot as plt
import scipy as sp

# matched notch filter


s = tf([1, 0], [1])
wno = 0.19
z1 = 0.05
z2 = 0.7
Hno = (1+2*z1/wno*s+s**2/wno**2)/(1+2*z2/wno*s+s**2/wno**2)

# the controller, Kp = 1 for now


Kp = 1.63
tau_PD = 50
Hc = (1 + tau_PD*s)*Kp

# start with the basic satellite model sat1, and get the
# payload attitude response
Hp = tf(sp.matrix([0, 0, 0, 1])*sat1)

# total open loop


Hol = Hc*Hno*Hp

Hclosed = Hol.feedback(1)

# step input
t = sp.arange(0, 250.1, 0.1)
y, t = step(Hclosed, t)
f0 = plt.figure()
plt.plot(t, y)

# the overshoot
print("overshoot", y.max()/y[-1]*100 - 100)

# ramp input
y, t, x = lsim(Hclosed, t, t)
f1 = plt.figure()
plt.plot(t, y)

# value at 250
print("at 250", y[t == 250.0][0])

# closed-loop frequency response


f2 = plt.figure()
mag, phase, w = bode(Hclosed, sp.logspace(-3, 0, 500))

# resonance peak in db
print("resonance", 20*sp.log10(mag.max()))

# bandwidth

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 31/32
6/22/2020 Practicon Exercise System TU Delft

print("bandwidth", w[mag > 10**(-3./20)][-1]/(2*sp.pi))

# damping
damp(Hclosed)

# alternative control structure


Hclosed2 = (Kp * Hno * Hp).feedback(1+tau_PD*s)
y, t = step(Hclosed2, t)
f3 = plt.figure()
plt.plot(t, y)

plt.show()

Practicon web-based exercise system, version: 6.0 (Feb 2015)

https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 32/32

You might also like