Lecture 8 - More State-Space and System Properties: G(S) G(S) 6205 S (+ 13s + 1281) S (S) Y (S) /R(S) H
Lecture 8 - More State-Space and System Properties: G(S) G(S) 6205 S (+ 13s + 1281) S (S) Y (S) /R(S) H
Lecture 8
ae2204 Aerospace Systems and Control Theory
6205
G(s) =
2
s (s + 13s + 1281)
Determine the closed-loop transfer function Heq (s) = Y (s)/R(s) , and determine the poles of that transfer
function.
2
1/τ ω
Heq (s) =
1/τ + s ω2 + 2ζ ωs + s2
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 1/33
6/30/2020 Practicon Exercise System TU Delft
1/τ
H1 (s) =
1/τ + s
2
ω
H2 (s) =
2 2
ω + 2ζ ωs + s
Calculate the step responses of the three transfer functions H1 (s) , H2 (s) , and Heq (s) , with a time step of
0.01 s and an end time of tend =1.5 [s] and calculate the following:
The integral of the absolute value of the difference between H1 (s) and Heq (s) , i.e.
tend
D1 = ∫ |y(t) − y1 (t)| dt
0
The integral of the absolute value of the difference between H2 (s) and Heq (s) , i.e.
D2 =
t end
∫0 |y(t) − y2(t) |dt
Note: use trapz to do the numerical integration in Matlab, and in Python, you can use
scipy.integrate.trapz
Another note: It does not hurt to plot the step responses, to see what you are doing ...
Your answer
Enter the value 0.0231
Feedback
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 2/33
6/30/2020 Practicon Exercise System TU Delft
s = tf('s')
% enter the open-loop transfer function
G = 6205 / (s * (s^2 + 13*s + 1281))
% create closed loop tf
Heq = feedback(G, 1)
% calculate the poles of the closed-loop transfer function:
p = pole(Heq)
Python version:
# create closed-loop tf
Heq = G.feedback(1)
p = pole(Heq)
Now, the first pole is the real pole, and according to the assignment now the transfer function has the shape
of:
with the information on the pole, can be entered in Matlab, and with that also can be split off:
H1 = 5/(s+5)
% split off H2, use minreal to remove a cancelling pole and zero
H2 = minreal(Heq / H1)
Now you can calculate the response of these two systems, and the closed-loop system, to a step input:
tend = 1.5
dt = 0.01
t = 0:dt:tend
% step responses
y = step(Heq, t)
y1 = step(H1, t)
y2 = step(H2, t)
Python version
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 3/33
6/30/2020 Practicon Exercise System TU Delft
H1 = 5/(s+5)
H2 = (Heq/H1).minreal()
Then calculate the difference between the system response and , respectively response:
% requested values;
D1 = trapz(t, abs(y1 - y))
D2 = trapz(t, abs(y2 - y))
% also plot the stuff:
plot(t', [y y1 y2])
Python version
From the plot you can also clearly see that the response of the combined system is much more like the
response of the first order pole, than like the response of the pair of complex conjugate poles. This matches
the theory, since the first order pole is the dominant pole.
You can also understand this when you perform partial fraction expansion, and then look in a good Laplace
table to see how the different components are to be translated back into the time domain.
Laplace:
Step function:
, in Laplace:
Damped sine:
, in Laplace:
Damped cosine:
, in Laplace:
The pair of complex eigenvalues can be converted to a sum of the damped sine and cosine in the Laplace
domain. The two real poles, for the decay and the step function, are simple to convert.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 4/33
6/30/2020 Practicon Exercise System TU Delft
Apologies for the students working with Python. Currently there is no equivalent for the residue function; but
don't worry, you will not need this on the exam.
The step response -- in the Laplace domain -- can thus be written as:
This means that, in the time domain, the step response results in the following:
Also from the terms in the partial fraction expansion (-1.0122 versus -0.1404 and 0.01223, all three multiplied
with functions starting at most at 1 and then diminishing) you can see that the term associated with the pole at
-5 contributes more to the response than the terms associated to the pair of complex poles (at ). The
important message is that the poles close to the origin contribute strongest to the system's response and
therefore matter most when later you are trying to create a controller. There are exceptions, however. One is
that unstable poles in the closed-loop systems produce an unbounded response and are therefore not
acceptable -- dominant or not. The other exception is that a normally dominant pole can be offset or
neutralized by a zero near its location.
Systems in series
If you have two state-space systems, you can connect them in series if the number of outputs of the first
system matches the number of inputs of the second system.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 5/33
6/30/2020 Practicon Exercise System TU Delft
s1 = rss(3, 1, 2)
s2 = rss(2, 3, 1)
stotal = s2 * s1
The function rss is a nice one, it gives you a random state-space system, for practice. The first parameter is
the number of state, second parameter number of outputs, and the third parameter is the number inputs. Note
the order of multiplication.
Quick quiz question, what will be the number of inputs, number of outputs and number of states of the
combined system? Check this by trying it in Matlab or Python!
Systems in parallel
If you have two state-space systems in parallel, you can connect them by adding them up:
Or in Matlab:
s1 = rss(3, 1, 2)
s2 = rss(2, 1, 2)
stotal = s1 + s2
The number of inputs and the number of outputs must be equal. Inspect the A matrix of the combined system.
You can see a typical block diagonal structure. The 4th and 5th states are apparently not connected to the
first three states.
Feedback loops
Help on the feedback function can be found by entering help feedback. In the examples it shows a number
of ways in which a feedback connection can be made.
One of the most common feedback operations is selecting one of the outputs and feeding these back with a
gain. Say we have a system with one input and four outputs, like the one given below. That system
represents the motions of a submarine. Its three states are , and (just like with an aircraft). The state-space
system has four outputs, the three aforementioned states and the "flight/float" path angle .
a = [ 0 1 0 ; ...
-0.0071 -0.111 0.12; ...
0 0.07 -0.3]
b = [ 0 ; -0.095; 0.072]
c = [ 1 0 0; ... % theta
0 1 0; ... % q
0 0 1; ... % alpha
1 0 -1] % gamma = theta - alpha
d = zeros(4, 1);
sys2 = ss(a, b, c, d)
The pitch rate from the submarine above, is fed back with a gain to improve the response characteristics. We
can create a "feedback matrix" that describes how the different outputs from must be fed back:
k = [ 0 -0.67 0 0]
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 6/33
6/30/2020 Practicon Exercise System TU Delft
When multiplied by the output, k gives back . There is already a minus sign in the response of the system to
the elevator input; positive elevator input gives a negative pitch rate. That is why we are using -0.67 here, in
most systems the feedback coefficient would be positive. Now the feedback is done with:
sclosed = feedback(sys2, k)
Inspect the open-loop and the closed-loop submarine. You may observe that only the A matrix changed.
Check how the two systems are related:
eig(sys2.A)
eig(sclosed.A)
The main change is in the location of the complex eigenvalues. In lecture 7 we will discuss what "good" and
what "bad" locations for eigenvalues are.
If you have two state-space systems, you can connect them in series if the number of outputs of the first
system matches the number of inputs of the second system.
Quick quiz question, what will be the number of inputs, number of outputs and number of states of the
combined system? Check this by trying it in Matlab or Python!
Systems in parallel
If you have two state-space systems in parallel, you can connect them by adding them:
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 7/33
6/30/2020 Practicon Exercise System TU Delft
s1 = rss(3, 1, 2)
s2 = rss(2, 1, 2)
stotal = s1 + s2
print stotal
The number of inputs and the number of outputs must be equal. Inspect the A matrix of the combined system.
You can see a typical block diagonal structure. The 4th and 5th states are apparently not connected to the
first three states.
Feedback loops
Help on the feedback function can be found by entering help feedback. In the examples it shows a number
of ways in which a feedback connection can be made.
One of the most common feedback operations is selecting one of the outputs and feeding these back with a
gain. Say we have a system with one input and four outputs, like the one given below. That system
represents the motions of a submarine. Its three states are , and (just like with an aircraft). The state-space
system has four outputs, the three aforementioned states and the "flight/float" path angle .
sysclosed = sys2.feedback(k)
Inspecting the system
When analysing a transfer function, one commonly looks at its poles, i.e. the roots of the denominator. In
Lecture 5, it is explained that the eigenvalues of the A matrix of a state space system are equal to the poles of
its equivalent representation as a transfer function. Therefore, in order to analyse stability (for this all poles
must have negative real values), we can look at the eigenvalues of the A matrix.
Inspect the open-loop and the closed-loop submarine. You may observe that only the A matrix changed.
Check how the two systems are related:
import scipy.linalg as la
print la.eig(sysclosed.A)[0]
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 8/33
6/30/2020 Practicon Exercise System TU Delft
print la.eig(sys2.A)[0]
The main change is in the location of the complex eigenvalues. In lecture 7 we discussed what "good" and
what "bad" locations for eigenvalues are.
This is a typical form for the state equations of an aircraft, describing the asymmetric motions. As you know,
is the side slip angle, is the roll angle, is the roll rate and is the yaw (rotation around the top axis) rate.
The aircraft has a fair amount of oscillation in the Dutch roll. Take a time span of 20 seconds, and calculate
the response of the yaw rate to a unit step input in rudder, and determine the value of the (negative) yaw rate
in the first (negative) peak.
As a suggestion, I would suggest that you choose an appropriate C matrix (giving you the proper output for
this problem).
Your answer
What is the peak value of the first oscillation peak (note that this peak is
-1.97
negative)
Feedback
Nice, a perfect score.
The procedure is simple. Enter the matrices into Matlab, create a state-space system and calculate the
response to a step:
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 9/33
6/30/2020 Practicon Exercise System TU Delft
Python version:
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 10/33
6/30/2020 Practicon Exercise System TU Delft
You can see that the aircraft displays quite a bit of oscillation in response to a sharp rudder input. This is very
common in fast jet aircraft with a high wingloading. This problem is normally removed with the application of a
yaw damper. Most aircraft are flown with the yaw damper always engaged.
To reduce the Dutch roll oscillation, a yaw damper is applied. This yaw damper measures yaw rate with a
gyroscope, and adds a certain input to the rudder input, as depicted in the diagram below:
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 11/33
6/30/2020 Practicon Exercise System TU Delft
Use the aircraft's state equation for the asymmetric motions, with as output vector , and create the closed-
loop state-space system. Assume that the measurement of yaw rate is perfect, and that the dynamics of the
actuator that is needed to move the rudder can also be neglected. Thus . Inspect and compare both the open-
loop and the closed-loop state-space system, and enter the closed-loop state-space system matrices. Note
that the closed-loop state-space system has the same outputs as listed before.
Due to the sign conventions in aircraft, the response from rudder to yaw rate already has a "minus"; positive
rudder input will result in negative yaw rate. The feedback gain is thus in general negative, in this case
Your answer
Enter the A, B, C and D matrices of this state-space system
A = [ -0.2000 0.0600 0 -0.9610; 0 0 1.0000 0; -17.0000 0 -3.8000 4.5100; 9.4000
0 -0.4000 -5.1500 ]
C=[1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1]
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 12/33
6/30/2020 Practicon Exercise System TU Delft
D = [0 0; 0 0; 0 0; 0 0]
B = [ -0.01, 0.06;
0.0, 0.0;
-32.0, 5.4;
2.6, -7.0 ]
C = [ 1, 0, 0, 0;
0, 1, 0, 0;
0, 0, 1, 0;
0, 0, 0, 1 ]
D = [ 0, 0;
0, 0;
0, 0;
0, 0 ]
Explanation / script
A = [ -0.2 0.06 0 -1;...
0 0 1 0;...
Feedback
Nice, a perfect score.
The procedure is nothing fancy. The only thing you need to carefully consider is getting the proper feedback
matrix.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 13/33
6/30/2020 Practicon Exercise System TU Delft
A block diagram for the system is given above. The input and output to the system in this case are not single
signals, but vectors. The input to the feedback matrix in this case is thus the output vector of the system. It
should produce a control vector that is compatible with the input vector of the system, thus containing 2
elements.
Enter that matrix in Matlab or Python, and use the feedback command to produce the closed-loop system.
% I hope by now you learned to keep your models in files, so you still
% have sys0, representing the state-space system of the asymmetric
% motions of the aircraft. You need a model that has the following
% outputs, beta, phi, p and r, so the C and D matrices must be modified
% if you need the A and B matrices, go look for them!
C = eye(4,4)
D = zeros(4,2)
sys = ss(A, B, C, D)
% now make a proper feedback matrix; feed back the 4th output (r) to the
% 2nd input (rudder, delta_r)
% think of this matrix as being multiplied by a 4-element vector (the
% output vector), and then producing a 2-element vector (the input vector)
Kr = -0.65
K = [ 0 0 0 0; 0 0 0 Kr];
sysc = feedback(sys, K)
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 14/33
6/30/2020 Practicon Exercise System TU Delft
# I hope by now you learned to keep your models in files, so you still
# have sys0, representing the state-space system of the asymmetric
# motions of the aircraft. You need a model that has the following
# outputs, beta, phi, p and r, so the C and D matrices must be modified
# if you need the A and B matrices, go look for them!
C = np.eye(4)
D = np.zeros((4,2))
sys = ss(A, B, C, D)
# now make a proper feedback matrix; feed back the 4th output (r) to the
# 2nd input (rudder, delta_r)
# think of this matrix as being multiplied by a 4-element vector (the
# output vector), and then producing a 2-element vector (the input vector)
Kr = -0.65
K = np.mat([[0, 0, 0, 0],[0, 0, 0, Kr]])
sysc = sys.feedback(K)
print(sysc)
In the previous example one can easily see that the aircraft with the yaw damper has better dutch roll
damping, by inspecting the eigenvalues of the A matrix.
Now, the damping may have been improved, but the airplane should still be flyable like a conventional
airplane; the yaw damper will also be active when the pilot flies the airplane manually. To check whether the
airplane's behaviour has changed in other aspects, we test the response to a block-shaped aileron input -- an
input signal that is representative of the input needed to enter a turn; a pilot will not exactly create a block
input signal for a entering turn, but something that looks a lot like it.
This response is calculated for three cases. Once for the aircraft without yaw damper, once of the aircraft with
the yaw damper, and once for the aircraft with a modified yaw damper.
The modified yaw damper uses a "wash-out" filter. This is commonly also called a "high-pass" filter, since it
passes (sine) signals with a high frequency, and blocks those with a low frequency. Discussion of these filters
returns in Lectures 11 to 14, but to get an idea, you might try to calculate the response to a step input signal
with such a filter.
For this step you need the aircraft model with the yaw rate as (single) output, and the aileron and rudder as
inputs, so modify the C and D matrices accordingly.
Thus, a state-space system with a state-vector with only one element. To save you some time, and maybe
make you realise how flexible Matlab actually is, here is the code to make the new feedback "matrix" (or
actually a feedback system), with the wash-out filter:
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 15/33
6/30/2020 Practicon Exercise System TU Delft
Again, . This assumes your system has two input signals, and , and you trimmed it to one output signal, only
the yaw rate $r$. The controller provides a corrective input to (zero, obviously) and to (Kd * ss(-0.5,
0.5, -1, 1) times the yaw rate).
In Python, the trick of entering a state-space matrix as element in a matrix does not work, and you need to
enter the complete feedback system, which accepts one input (yaw rate), and provides two outputs, of which
the first is always 0. The feedback system with wash-out is:
import numpy as np
from control.matlab import ss
Your answer
What is the damping coefficient of the dutch-roll mode (the oscillatory pair
7.98e-02
of poles) for the basic aircraft?
What is the damping coefficient of the dutch-roll mode (the oscillatory pair
7.72e-01
of poles) for the aircraft with the simple yaw damper?
For the aircraft without the yaw damper, what is the yaw rate at ? -0.3248
For the aircraft with the simple yaw damper, i.e., when the yaw damper
-0.1120
consists of only a gain, what is the yaw rate at ?
For the aircraft with the more complex yaw damper, i.e., when the yaw
damper consists of a gain and uses a wash-out filter, what is the yaw rate -0.3060
at ?
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 16/33
6/30/2020 Practicon Exercise System TU Delft
What is the damping coefficient of the dutch-roll mode (the oscillatory pair
0.77249975
of poles) for the aircraft with the simple yaw damper?
For the aircraft without the yaw damper, what is the yaw rate at ? -0.30844554
For the aircraft with the simple yaw damper, i.e., when the yaw damper
-0.10628481
consists of only a gain, what is the yaw rate at ?
For the aircraft with the more complex yaw damper, i.e., when the yaw
damper consists of a gain and uses a wash-out filter, what is the yaw rate -0.29069598
at ?
Explanation / script
A = [ -0.2 0.06 0 -1;...
0 0 1 0;...
Feedback
Nice, a perfect score.
Now, this assignment already looked like some mature Matlab or Python control engineering! For the
technicalities, look at the example implementation:
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 17/33
6/30/2020 Practicon Exercise System TU Delft
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 18/33
6/30/2020 Practicon Exercise System TU Delft
# now make versions with yaw damper; plain one and the one with the washout
# filter
Kr = -0.65
# feedback matrix for plain yaw damper
K_plain = np.mat([[0],[Kr]])
sys_plain = sys.feedback(K_plain)
# feedback system for washout yaw damper, one input, two outputs,
# da is always 0, and dr
A_fb = np.mat([[-0.5]])
B_fb = np.mat([[0.5]])
C_fb = np.mat([[0], [-Kr]])
D_fb = np.mat([[0], [Kr]])
K_wash = ss(A_fb, B_fb, C_fb, D_fb)
sys_wash = sys.feedback(K_wash)
plt.show()
You see that the response of the aircraft without yaw damper oscillates quite a lot. The Dutch Roll is really
kicking in here! The damping coefficient corresponding to this motion is quite low, approximately 0.08, so that
is what you can expect.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 19/33
6/30/2020 Practicon Exercise System TU Delft
For the aircraft with either one of the yaw dampers you get quite good damping for the dutch roll, in the order
of 0.7. Initially, the two responses for the aircraft with the two yaw damper variants (green and red lines in my
plot) look quite similar. However, then the yaw rate of the aircraft with our original yaw damper (with only a
gain ) starts to reduce again. This is not desired, since it means that after the pilot has started the turn, the
aircraft will straighten itself out of the turn again. Conventional aircraft will stay in the turn.
How does the washout filter fix that? Without the washout filter, the yaw damper senses a constant turn rate
(intended by the pilot!) during the turn. The damper control rate makes the rudder constantly deflect against
that, effectively counteracting the turn of the aircraft and reducing the turn rate. A wash-out filter removes
(``washes out'') the constant values it sees in the input. Try a step response with just the washout filter:
t = 0:0.1:10;
wash = ss(-0.5, 0.5, -1, 1)
y = step(wash, t);
plot(t, y)
Or in Python
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 20/33
6/30/2020 Practicon Exercise System TU Delft
You see the output jumping to 1 at the start of the response, but then the output reduces and goes to 0. This
means that after a short while in the turn the washout filter removes the constant turn rate sensed, and the
yaw damper will set the rudder to 0 again; the aircraft stays in the turn.
As you can see the washout filter did not affect the ability of the yaw damper to improve the damping of the
dutch roll. The dutch roll oscillations are fast enough to pass almost completely through the washout filter.
Tuning of such filters is generally done in the "frequency domain", where a system is characterised by which
frequencies of sine signals it passes respectively blocks. This is treated in lectures 11 to 14.
Introduction
A fundamental skill in systems and control theory is the creation of the system model. In many real-life
projects, design of the control systems and evaluation of the system dynamics starts while the system is in
the design phase. You have bits and pieces of the system, that have to be combined into a system model.
You might have an initial design of the controller in transfer function form, a model for the system dynamics in
state-space form, and specifications for the control actuators (that move e.g., the elevator, aileron and rudder
of the aircraft) and sensors (to measure attitude, altitude, etc.) that you can convert into a transfer function or
a state-space model.
It is possible to write out a state-space model for the total system by hand, and then enter it into a CACSD
package, but it is also possible, and often much quicker, to enter the bits and pieces in the CACSD package
as individual system models, and then combine them. In this part of the e-lecture, you practice just that.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 21/33
6/30/2020 Practicon Exercise System TU Delft
It contains a controller with a gain and a double integrator that models the kinematics of the satellite (division
of the total torque by the inertia of the satellite gives rotational acceleration; integrate that once and you get
rotational velocity; integrate again and you get the angular position). The satellite attitude is measured with a
sensor, and the sensor dynamics are given as a transfer function:
The rotational velocity is measured by the same sensor. To represent that a differentiating block is added in
the block diagram (with an s; representing differentiation). This rotational velocity is added to the position
measured by the sensor, and then used in the feedback path.
In this first step, a series of ``small'' systems is created for all the little pieces of the system. Note that the
process of constructing a system model will require consistent bookkeeping, so that later we don't end up
connecting the wrong pieces of the model.
First part is the satellite attitude response to torque. This is modelled as a double integrator, for convenience
the moment of inertia is assumed to be 1. We need as outputs the satellite attitude and its velocity. Start by
entering the satellite as a transfer function:
s = tf('s')
h1 = 1/s^2
To get the velocity as an output, a transfer function matrix is needed, 1 input, and two outputs.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 22/33
6/30/2020 Practicon Exercise System TU Delft
ssat = ss(hs)
Verify that it has two states, two outputs and one input. We requested that the first output would be the
attitude, and the second would be the velocity. From the C matrix we see that apparently the first state
variable is the attitude, and the second is the velocity. However, you cannot always count on that, ssis free to
choose its own preferred state variables!
The next system to convert is the transfer function for the sensor. Here we have the same requirement, we
need measured output and the velocity.
The last system we need is the controller. The controller has no dynamics, simply a gain, and the following
code is valid for both Matlab and Python:
Ks = 0.5
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 23/33
6/30/2020 Practicon Exercise System TU Delft
Since the controller has no dynamics, it is not necessary to enter a full system, in the next section you will see
that the simple variable Kscan simply be used as a system with one input and one output.
Examine this system, and compare it to the three systems made earlier. What happened is that we now have
a system with:
The command appendsimply glued the systems together. The first input, the first two states and the first two
outputs correspond to the first system, the next input and two outputs correspond to the other system, and the
last input and output correspond to the gain .
The model that we end up with can be seen in the following picture.
Let's look again at the list of inputs and outputs for the combined model:
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 24/33
6/30/2020 Practicon Exercise System TU Delft
The command connectneeds the unconnected system, a connection matrix and vectors which indicate the
final inputs and outputs.
The connection matrix lists, for each input in the system, what outputs are connected to it. Each row of the
connection matrix specifies that for one of the inputs. For example, to connect the output of the controller (#
5) to the input of the satellite, we need a row with:
Q = [1 5]
The ``1'' here indicates the first input, and ``5'' indicates the 5th output.
The input of the controller (#3) needs to be connected to the output of the sensor and to the sensor rate (#3
and #4). Note however, that this is feedback, and there is a ``-'' in the summation; to tell that to Matlab, we
have to add a - to the connection:
To keep matrix Qsquare, we needed to add a 0 to the first row. Extending the matrix further, by connecting the
satellite output (#1) to the sensor input (#2):
The next step is selecting the inputs and outputs. From the assignment, we need one input, , which enters at
the controller (input #3), and three outputs; the controller output, attitude and rotational velocity, so outputs #5,
#1 and #2. Enter this in Matlab:
inputs = [ 3 ]
outputs = [5 1 2]
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 25/33
6/30/2020 Practicon Exercise System TU Delft
The Matlab help pages can explain you more about the connect command. Inspect the connected system.
You will see that the A matrix now contains additional non-zero elements, off the ``block diagonal''. The B
matrix is trimmed to represent the single external input, and the C matrix is trimmed to the three desired
outputs. The D matrix contains a non-zero element, indicating ``direct feedthrough'', in the output representing
the control signal to the satellite.
Note that this procedure requires careful bookkeeping. Mix up inputs and outputs, and you end up with a
system that is not at all what you intended to. One way to at least partially check your work is to create a
transfer function for the closed-loop system, and verify that at least the eigenvalues of the A matrix are equal
to the poles of your transfer function:
If you can't remember why this should be true, check Nise's book, Chapter 4.10
Python version
Note that you will need a new control module for this to work in Python
The following block diagram shows a controller for the roll angle of an aircraft. Please give a description for
this system in state-space format. The output vector should contain output of the autopilot, the actuator
output (is equal to the aileron deflection) and the aircraft roll angle, in that order.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 26/33
6/30/2020 Practicon Exercise System TU Delft
4
1.2
0.4
Your answer
Enter the A, B, C and D matrices of this state-space system
A = [ -5.0000 -2.2500 0 -1.3333; 4.0000 0 0 0; 0 2.2500 -0.8333 0; 0
0 1.0000 0 ]
B = [ 0.800; 0; 0; 0 ]
D = [ 0.4; 0; 0 ]
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 27/33
6/30/2020 Practicon Exercise System TU Delft
B = [ 0.0;
1.2;
0.0;
0.0 ]
D = [ 0.4;
0.0;
0.0 ]
Explanation / script
%electure 8 connections
Feedback
Very good, a perfect score.
Matlab variant
First create the pieces:
s = tf('s')
// autopilot
Kap = 0.4
% actuator
Hact = ss(9/(s^2 + 5*s + 9))
% aircraft
Ka = 4
tau_a = 1.2
Hac = ss(Ka/(1+tau_a*s)/s)
Then join everything. Output list will be, after this step: output of autopilot, actuator output (), aircraft roll angle
().
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 28/33
6/30/2020 Practicon Exercise System TU Delft
Python variant
First create the pieces:
import numpy as np
from control.matlab import *
# Laplace variable
s = tf([1, 0], [1])
# autopilot gain
Kap = 0.4
# actuator
Hact = ss(9/(s**2 + 5*s + 9))
# aircraft
Ka = 4
tau_a = 1.2
Hac = ss(Ka/(1+tau_a*s)/s)
# python-control append will not work when it starts with Kap, need to have
# a state-space system first
sys = append(Hact, Hac, Kap)
Then join everything. Output list will be, after this step: output of autopilot, actuator output (), aircraft roll angle
().
# indexing,
# input 1: actuator, connect to autopilot (3)
# input 2: aircraft, connect to actuator (1)
# input 3: autopilot gain, negative feedback from aircraft (-2)
Q = np.mat('''1 3;
2 1;
3 -2''')
inputs = [3]
outputs = [3, 1, 2]
# connect
sysc = connect(sys, Q, inputs, outputs)
print(sysc)
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 29/33
6/30/2020 Practicon Exercise System TU Delft
A model for the altitude response of the Moller SkyCar Moller International (http://www.moller.com/)is shown
in the following block diagram, in combination with a model for the control system. Convert the following
diagram into a state-space model, with the reference altitude () as input and the altitude () and the output of
the controller (), in that order, as output signals.
Your answer
Enter the A, B, C and D matrices of this state-space system
A = [-10.0000 0 0 0 0 -16.0000; 1.0000 0 0 0 0 0; -9.5000
0.2500 -1.0000 -2.0000 0 -16.000; 0 0 2.0000 0 0 0; 0 0 0 1.0000
0 0; 0 0 0 0 1.0000 0
]
B = [16; 0; 16; 0; 0; 0 ]
D = [0; 32 ]
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 30/33
6/30/2020 Practicon Exercise System TU Delft
B = [ 0.0;
0.0;
0.0;
32.0;
D = [ 0;
32 ]
Explanation / script
s = tf('s');
K = 0.8;
Feedback
Very good, a perfect score.
First create the pieces:
s = tf('s')
% fill in your controller gain
K = 0.8
% controller transfer function, g
G = K*(4*s^2 + 2*s + 1)/(s*(1 + 0.1*s))
% system transfer function, the Skycar
H = 1/s^2/(s^2 + s + 4)
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 31/33
6/30/2020 Practicon Exercise System TU Delft
K = 0.8
# controller transfer function, g
G = K*(4*s**2 + 2*s + 1)/(s*(1 + 0.1*s))
# system transfer function, the Skycar
H = 1/s**2/(s**2 + s + 4)
I will be re-using the skycar later in the lecture, because it has some quite interesting (and strange)
properties.
Most systems have either one dominant pole or a complex pair of dominant poles. These are the poles
closest to the origin in the complex s-plane. As you calculated the step-response for such a system, you see
that the response looks most like the response of the dominant pole alone.
With the example of the yaw damper, you saw that the bad damping coefficient of the dutch roll causes
oscillatory responses. Improving the damping coefficient with yaw rate feedback helps significantly.
This example also showed of the use of state-space systems in control theory. Depending on the needed
outputs, the C and D matrices can be adjusted, and with the feedbackcommand the controller can be made,
resulting in a new state-space system for the closed-loop system.
For converting larger and more complex diagrams, you can use the append and connect calls. With these,
you can let Matlab combine your sub-systems for you.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 32/33
6/30/2020 Practicon Exercise System TU Delft
All in all, you should now be prepared for control theory with the most basic method, ``trial and error''. You
know how to read and correlate system response properties (damping, zeros, poles, dominant poles), you
can handle system models in differential equation, transfer function and state-space form, you know the basic
controller types (P, PI, PD, PID), you can create closed-loop systems from block diagrams (with feedback or
connect) and you can calculate responses.
In the following lectures we will focus on better tuning methods than the trial and error approach, starting with
root-locus in Lecture 9.
https://practicon.lr.tudelft.nl/practicon/index.html?extauth=1 33/33