Sol7 PDF
Sol7 PDF
Sol7 PDF
1. Buoyancy
An engineer would like to deploy an autonomous communications balloon (like Project Loon’s balloons:
https://plus.google.com/+ProjectLoon/posts/PVitgyeYweY) to provide internet con-
nectivity to a particular geographical region. To provide reliable connectivity, the balloon must hold its
position over the region it services. The balloon can control its altitude (a) by changing its buoyancy, but
it doesn’t have any engines. In order to move horizontally (horizontal position p), the balloon drifts on air
currents.
Consulting meteorologists, the engineer has modeled the air currents around the desired balloon position
(the point (0,0)) and found the flow field shown in Figure 2.
v p = −20p + 20a
va = −20p + 20a
where the velocities are in kilometers per hour and the horizontal position and altitude are in kilometers.
Putting this together with the balloon’s buoyancy control, the balloon’s dynamics are described by:
" # " #" # " #
ṗ −20 20 p 0
= + u
ȧ −20 20 a 5
Solution:
λ + 20 −20
=0
20 λ − 20
λ2 = 0
λ1 = λ2 = 0
(b) What is the matrix T for the change of variables~z = T~x that transforms the original A and B matrices
into controllable canonical form?
Solution:
" #
h i 100 0
R̃n = ÃB̃ B̃ =
100 5
" #
h i 1 0
Rn = AB B =
0 1
" #
0.01 0
T = Rn R̃−1
n =
−0.2 0.2
(c) The engineer would like the balloon to converge to (0,0) with eigenvalues -1 and -1. What should be
the state feedback gains K̃ multiplying the original state vector ~x to achieve this behavior? Write the
expression for u in terms of p and a.
(λ + 1)(λ + 1) = 0
λ 2 + 2λ + 1 = 0
Solution: To make the system observable but not controllable we should choose γ = 0.
(a) Which state should we control with the actuator to make the system controllable?
" #
1
Solution: We should control the state x1 . This makes the control matrix B = hence
0
" #
1 −1
C= .
0 1
4. Observability
Consider the following continuous time system.
ẋ(t) = Ax(t) + Bu(t)
(1)
y(t) = Cx(t)
We want to construct an estimate z of the system state x. To do so, we construct a pretend system with the
same [A, B,C, D] models, the same input and the output of the last system along with an L system matrix.
We do this to try and exploit the difference between the output of our pretend state and the actual output,
with L being the "knob" that we can control.
Define e(t) = z(t) − x(t). This is the error term as a function of time.
(a) Using the two systems defined above, construct a system of the form,
de
(t) = (A + LC)e(t) (3)
dt
(b) We want,
lim e(t) = 0
t→∞
What does that imply about (3)?
Solution: This means that we want (3) to be stable: all of the eigenvalues of (A + LC) should have a
real component less than zero.
(c) Does the initial value of the guess z(0) matter in the long term?
Solution: Not really, since the e(t) tends to 0. This means that, no matter how bad our initial guess,
we will eventually have a good estimate.
5. CCR circuit
Consider the circuit below driven by a current source with current u(t). The output y(t) is the voltage across
the resistor and the state variables are the capacitor voltages as marked in the circuit diagram.
u(t)
+ +
x1 (t) C1 x2 (t) C2
− −
To bringNote
Solution: t) to
~x (that theofequilibrium
at any xpart
the equilibria in~ 0 we
=(b) apply
the output is identically zero. So there is no way
to distinguish between for example the system being in configuration x1 = 1, x2 = 1 from x1 = 0, x2 = 0.
u(t) = K~x (t)
and
6. Inverted obtain
pendulum the closed-loop system
Consider the inverted pendulum depicted below, whose equations of motion are
d
x
~ ( t ) = ( A + BK )~x ( t ).
ÿ = M
1 udt+ θ̇ 2 ` sin θ − g sin θ cos θ
2 m
m + sin θ
The only difference from discrete-time is the stability criterion: we
must choose θ̈ = K Msuch 2that
1 Re u λi ( A +2 BK )} < 0 for
− {cos θ − θ̇ ` cos θ sin θ +
M +each
m
g sineigenvalue
θ . λi .
`( m + sin θ ) m m
Example 3: Consider the inverted pendulum system depicted below.
m
θ `
u
M
y
The equations of motion are
(a) Write the state model using the variables x1 (t) = θ (t), x2 (t) = ! θ̇ (t), and x3 (t) = ẏ(t). We do not
1 variableubecause
include y(t) as a state 2 we are interested in stabilizing the point θ = 0, θ̇ = 0, ẏ = 0,
ÿ are
and we = not
M concerned
2 about +
the θ̇
final` sin θ
value −
of g
thesin θ cos
position θ
y(t).
m + sin θ m
!
Solution: We have,
1 u M + m
x˙1θ̈ =
= x2 M − cos θ − θ̇ 2 ` cos θ sin θ + ,gf1sin
(x1 ,θx2 , x3 , u)
`( m + sin2 θ ) m m
1
x˙2 = l M +sin − mu cos(x1 ) − x22 l cos(x1 ) sin(x1 ) + M+m
m g sin(x1 ) , f2 (x1 , x2 , x3 , u)
( m
2
(x1 ))
and linearization about the upright position θ = 0, θ̇ = 0 gives
x˙3 = M +sin1 2 (x ) u
m + x 2 l sin(x
2 1 ) − g sin(x 1 ) cos(x1 ) , f3 (x1 , x2 , x3 , u)
m 1
m 1
ÿ = − gθ + u
M M (5)
EECS 16B, Fall 2017, Homework 7 M+m 1 6
θ̈ = gθ − u.
M` M`
We write (5) in state space form as
(b) Linearize this model at the equilibrium x1 = 0, x2 = 0, x3 = 0, and indicate the resulting A and B
matrices.
Solution: We can keep in mind that x1 = x2 = x3 = 0 to make the derivative much easier. Since we
aren’t asked to linearize about a particular input, we can linearize about u∗ = 0. This is fine because f2
and f3 are affine (linear plus a constant term) with respect to u.
∂ f1 ∂ f1 ∂ f1
∂ x1 (0, 0, 0, 0) =0 ∂ x2 (0, 0, 0, 0) =1 ∂ x3 (0, 0, 0, 0) =0
∂ f2 M+m ∂ f2 ∂ f2
∂ x1 (0, 0, 0, 0) = lM g ∂ x2 (0, 0, 0, 0) =0 ∂ x3 (0, 0, 0, 0) =0
∂ f3 m ∂ f3 ∂ f3
∂ x1 (0, 0, 0, 0) = −M g ∂ x2 (0, 0, 0, 0) =0 ∂ x3 (0, 0, 0, 0) =0
And,
∂ f1 ∂ f2 1 ∂ f3 1
∂ u (0, 0, 0, 0) =0 ∂ u (0, 0, 0, 0) = − lM ∂ u (0, 0, 0, 0) = M
Since x∗ = 0 and u∗ = 0, we can use the same state variables x and u. Then,
x1 0 1 0 x1 0
d M+m 1
x2 = lM g 0 0 x2 + − lM u
dt m 1
x3 −M g 0 0 x3 M
| {z } | {z }
A B
or,
x1 0 1 0 x1
d
x2 = 11 − k1 −k2 −k3 x2
dt
x3 k1 − 1 k2 k3 x3
The characteristic polynomial is,
(e) Suppose we set k2 = k3 = 0 and vary only k1 ; that is, the controller uses only θ (t) for feedback. Does
there exist a k1 value such that all closed-loop eigenvalues have negative real parts?
v∗ + β
u(t) =
θ
(a) In reality, we need to "kickstart" electric motors with a pulse in order for them to work. That is, we
can’t go straight from 0 to our desired input signal for u(t), since the motor needs to overcome its
initial inertia in order to operate in accordance with our model.
Let us model the pulse as having a width (in timesteps) of t p . In order to model this phenomenon, we
can say that u(t) = 255 for t ∈ [0,t p − 1]1 . In addition, the car initially (at t = 0) hasn’t moved, so we
can also say d(0) = 0.
Firstly, let us examine what happens to dL and dR at t = t p , that is, after the kickstart pulse has passed.
Find dL (t p ) and dR (t p ). (Hint: if it helps, try finding dL (1) and dR (1) first, and then generalizing to the
t p case.)
Note: it is very important that you distinguish θL and θR , as the motors we have are liable to vary in
their parameters, just as how real resistors vary from their ideal resistance.
Thus we get:
dL (t p ) = t p (255θL − βL )
dR (t p ) = t p (255θR − βR )
(b) Let us define δ (t) = dL (t) − dR (t) as the difference in positions between the two wheels. If both
wheels of the car are going at the same velocity, then this difference δ should remain constant, since
no wheel will advance by more ticks than the other. As a result, this will be useful in our analysis and
in designing our control schemes.
Find δ (t p ). For both an ideal car (θL = θR , βL = βR ) where both motors are perfectly ideal and a
non-ideal car (θL 6= θR , βL 6= βR ), did the car turn compared to before the pulse?
(Since d(0) = dL (0) = dR (0) = 0, δ (0) = 0.)
1 x ∈ [a, b] means that x goes from a to b inclusive.
δ (t p ) = dL (t p ) − dR (t p )
δ (t p ) = t p (255θL − βL ) − t p (255θR − βR )
δ (t p ) = t p ((255θL − βL ) − (255θR − βR ))
δ (t p ) = t p (255(θL − θR ) − (βL − βR ))
For an ideal car, both the θL − θR and βL − βR terms go to zero, so the pulse made the car go perfectly
straight. However, in the non-ideal car, we aren’t so lucky, since the car did turn somewhat during the
initial pulse.
(c) We can still declare victory, though, even if the car turns a little bit during the initial pulse (t p will be
very short in lab), so long as the car continues to go straight afterwards when we apply our control
scheme; that is, as long as δ (t → ∞) converges to a constant value (as opposed to going to ±∞ or
oscillating).
Let’s try applying the open-loop control scheme we learned last week to each of the motors indepen-
dently, and see if our car still goes straight.
v∗ + βL
uL (t) =
θL
∗
v + βR
uR (t) =
θR
Let δ (t p ) = δ0 . Find δ (t) for t ≥ t p in terms of δ0 . (Hint: as in part (a), if it helps you, try finding
δ (t p + 1), δ (t p + 2), etc and generalize to the δ (t) case.)
Does δ (t → ∞) change from δ0 ? Why or why not?
Solution:
δ (t p + 1) = dL (t p + 1) − dR (t p + 1)
= dL (t p ) + θL u(t) − βL − (dR (t p ) + θR u(t) − βR )
= dL (t p ) + θL u(t) − βL − dR (t p ) − θR u(t) + βR
= dL (t p ) − dR (t p ) + θL u(t) − βL − θR u(t) − βR
= dL (t p ) − dR (t p ) + v∗ − v∗
= dL (t p ) − dR (t p )
= d(t p )
= δ0
δ (t) = δ0 (by generalization: every step does not change δ )
Since we are able to apply just the right amount of input PWM to keep a constant velocity on both
wheels, neither wheel gets ahead of the other, so δ (t) does not change, meaning that the car does not
turn.
(d) Unfortunately, in real life, it is hard to capture the precise parameters of the car motors like θ and β ,
and even if we did manage to capture them, they could vary as a function of temperature, time, wheel
conditions, battery voltage, etc. In order to model this effect of model mismatch, we consider model
Let us try applying the open-loop control scheme again to this new system. Note that no model
mismatch terms appear below - this is intentional, since we our control scheme is derived from the
model parameters for θ , β , not from the actual θ + ∆θ , etc.2
v∗ + βL
uL (t) =
θL
∗
v + βR
uR (t) =
θR
Solution:
δ (t p + 1) = dL (t p + 1) − dR (t p + 1)
= dL (t p ) + (θL + ∆θL )uL (t) − (βL + ∆βL ) − dR (t p ) + (θR + ∆θR )uR (t) − (βR + ∆βR )
= dL (t p ) − dR (t p ) + (θL + ∆θL )uL (t) − (βL + ∆βL ) − (θR + ∆θR )uR (t) − (βR + ∆βR )
= δ (t p ) + (θL + ∆θL )uL (t) − (βL + ∆βL ) − (θR + ∆θR )uR (t) − (βR + ∆βR )
= δ0 + θL uL (t) − βL + ∆θL uL (t) − ∆βL − θR uR (t) − βR + ∆θR uR (t) − ∆βR
= δ0 + v∗ + ∆θL uL (t) − ∆βL − v∗ + ∆θR uR (t) − ∆βR
= δ0 + v∗ − v∗ + ∆θL uL (t) − ∆βL − ∆θR uR (t) − ∆βR
= δ0 + ∆θL uL (t) − ∆βL − ∆θR uR (t) − ∆βR
∆θL ∗ ∆θR ∗
= δ0 + (v + βL ) − ∆βL − (v + βR ) − ∆βR
θL θR
!
∆θL ∗ ∆θR ∗
δ (t) = δ0 + (t − t p ) (v + βL ) − ∆βL − (v + βR ) − ∆βR (generalizing)
θL θR
If there is no model mismatch (i.e. all mismatch terms are zero), then we are back to the same case as
last time (all those terms drop out and δ does not change).
If there is model mismatch, however, we are not so lucky though :-(
!
∆θL ∗ ∆θR ∗
As t → ∞, the term (v + βL ) − ∆βL − (v + βR ) − ∆βR (which is highly unlikely
θL θR
to be zero) causes δ to either steadily increase or decrease, meaning that the car turns steadily more
and more.
2 Why not just do a better job of capturing the parameters, one may ask? Well, as noted above, the mismatch can vary as a
function of an assortment of factors including temperature, time, wheel conditions, battery voltage, and it is not realistic to try to
capture the parameters under every possible environment, so it is up to the control designer to ensure that the system can tolerate a
reasonable amount of mismatch.
Contributors:
• Justin Yim.
• John Maidens.
• Siddharth Iyer.
• Murat Arcak.
• Edward Wang.