Exercise 4

Problem 1: Controller parameterizations

This problem studies the equivalence between the below 2-dof controller parameterizations

obs_command.pngCffCfb.pngRST.png

1.A:

Show that the observer-based feedback control law LaTeX: u=-L\hat x + l_r y_ru=Lˆx+lryr, where LaTeX: \hat xˆx is given by a Kalman filter, kan be written as

LaTeX: U(s) = -C_{\text{fb}}Y(s) + C_\text{ff}Y_r(s)U(s)=CfbY(s)+CffYr(s),

with

LaTeX: \begin{aligned}
C_\text{fb}(s) & = L(sI - A + BL + KC)^{-1} K \\
C_\text{ff} & = (I - L(sI - A + BL + KC)^{-1}B)l_r \\
& = (I + L(sI - A + KC)^{-1}B)^{-1}l_r
\end{aligned}Cfb(s)=L(sIA+BL+KC)1KCff=(IL(sIA+BL+KC)1B)lr=(I+L(sIA+KC)1B)1lr

1.B

Show that the controller above can be written as

LaTeX: R(s)U = -S(s)Y + T(s)Y_rR(s)U=S(s)Y+T(s)Yr,

with

LaTeX: \begin{aligned}
R(s) & = \det(sI - A + BL + KC) \\
T(s) & = l_r\cdot\det(sI - A + KC)
\end{aligned}R(s)=det(sIA+BL+KC)T(s)=lrdet(sIA+KC)

Hence, the observer polynomial equals the zero polynomial of the feedforward controller LaTeX: C_\text{ff}Cff

Problem 2: Euclid, Bezout and Diophantine

Detail of Raphael's impression of Euclid, teaching students in The School of Athens (1509–1511)

(From wikipedia)

This exercise takes you through Euclid's algorithm, the Bezout identity and Diophantine equations. Going through this takes a bit of work, but will give you the tools to understand and implement pole-placing algorithms.

Euclid's algorithm

Let LaTeX: ll, LaTeX: mm and LaTeX: nn be natural numbers. If LaTeX: m = knm=kn for some natural number LaTeX: kk, then LaTeX: nn is a divisor of LaTeX: mm. If also LaTeX: l = k'nl=kn for some natural number LaTeX: k'k, then LaTeX: mm is a common divisor of LaTeX: ll and LaTeX: mm.

Euclid's algorithm finds the greatest common divisor of two natural numbers.

2a)

 

  •  Let LaTeX: m > nm>n and let LaTeX: ll be the greatest common divisor of LaTeX: mm and LaTeX: nn (LaTeX: l = \textrm{gcd}(m, n)l=gcd(m,n)). Prove that LaTeX: l = \textrm{gcd}(m - n, n)l=gcd(mn,n)

Now, let LaTeX: m_0 = mm0=m, LaTeX: n_0 = nn0=n and consider the recursion

LaTeX: \begin{aligned}
m_{i+1} & = \max(m_i-n_i, n_i) \\
n_{i+1} & = \min(m_i-n_i, n_i)
\end{aligned}mi+1=max(mini,ni)ni+1=min(mini,ni).

2b)

  • Show that if LaTeX: n_i = 0ni=0 for some LaTeX: ii, then LaTeX: m_i = gcd(m, n)mi=gcd(m,n).
  • Show that the algorithm converges in finite time.
  • Compute LaTeX: gcd(210, 84)gcd(210,84) using Euclid's algorithm

An improvement due to Gabriel Lamé (1844)

image.png

Let LaTeX: mm and LaTeX: nn be integers. Define LaTeX: r_{-2} = mr2=m and LaTeX: r_{-1} = nr1=n. Given LaTeX: r_{k-2}rk2 and LaTeX: r_{k-1}rk1 perform division with remainder by finding an integer quotient LaTeX: q_kqk and remainder LaTeX: r_krk:

LaTeX: r_{k-2} = q_k r_{k-1} + r_krk2=qkrk1+rk,

until LaTeX: r_n = 0rn=0. This gives a sequence LaTeX: r_{-2} = m, r_{-1} = n,r_0, \ldots, r_{n} = 0r2=m,r1=n,r0,,rn=0.

2c)

  • Prove that the above recursion converges.
  • Prove that LaTeX: r_{n-1}rn1is a common divisor of LaTeX: r_{-2}, r_{-1}, \ldots, r_{n-2}r2,r1,,rn2
  • Let LaTeX: ll be another common divisor of LaTeX: mm and LaTeX: nn, show that LaTeX: ll also divides LaTeX: r_{n-1}rn1
  • Compute LaTeX: gcd(210, 84)gcd(210,84) using the improved version.

Divisors of integers are defined analogously to natural numbers.

Bézout's identity

image.png

Bezout's identity: Assume that LaTeX: mm and LaTeX: nn are integers and that LaTeX: d = \textrm{gcd}(m, n)d=gcd(m,n). Then there exist integers LaTeX: xx and LaTeX: yy such that LaTeX: mx + ny = dmx+ny=d.

2d)

  • Show that if LaTeX: (x, y)(x,y) solves LaTeX: mx + ny = dmx+ny=d, then all solutions can be obtained from LaTeX: \left( x - k\frac{n}{d}, y + k \frac{m}{d}\right)(xknd,y+kmd).
  • Use Euclid's algorithm (based on division with remainder) to prove Bezout's identity.
  • Show that the extended euclidean algorithm (below) computes x and y with LaTeX: r_{n-1} = drn1=d, LaTeX: x = s_{n-1}x=sn1 and LaTeX: y = t_{n-1}y=tn1.

The extended euclidean algorithm adds two extra quantities LaTeX: s_{-2} = 1, s_{-1} = 0, \ldots, s_{n-1}s2=1,s1=0,,sn1 and LaTeX: t_{-2} = 0, t_{-1}= 1, \ldots, t_{n-1}t2=0,t1=1,,tn1 (in addition ro LaTeX: r_krk and LaTeX: q_kqk that follow the recursive relationship

LaTeX: \begin{aligned}
r_{k-2} & = q_k r_{k-1} + r_k \\
s_{k-2} & = q_ks_{k-1} + s_k \\
t_{k-2} & = q_kt_{k-1} + t_k
\end{aligned}rk2=qkrk1+rksk2=qksk1+sktk2=qktk1+tk

Diophantine equations

Diophantus of alexandria, source: https://accessoclub.com/diophantus-the-father-of-algebra/

Consider the linear Diophantine equation LaTeX: ax + by = cax+by=c where LaTeX: a, b, ca,b,c are fixed integers and LaTeX: x, yx,y are unknown integers to be solved for.

2e)

  • Prove that the linear Diophantine equation has a solution if, and only if LaTeX: c = k \cdot \textrm{gcd}(a, b)c=kgcd(a,b).

All of the development until now concerned integers. So how does this relate to pole placement? In L7:Pole Placement, we reduced pole-placement to solving a polynomial equation known as a polynomial Diophantine Equation:

LaTeX: AX + BY = CAX+BY=C

where LaTeX: A, B,\ CA,B, C are given polynomials and LaTeX: X,\ YX, Y are unknowns to be solved for.

Polynomials (over a field) share many of the algebraic properties of integers:

Property Polynomials Integers
Irreducability LaTeX: (s - a)(sa) for any LaTeX: aa primes: n = -1,1,2,3,5,7,11..
Fundamental theorem Algebra: LaTeX: X(S) = (s-a_1)^{n_1}(s-a_2)^{n_2}\cdots(s-a_n)^{n_n}X(S)=(sa1)n1(sa2)n2(san)nn

Arithmetic: LaTeX: m = a_1^{n_1}a_2^{n_2}\cdots a_n^{n_n}m=an11an22annn, LaTeX: a_iai prime

greatest common divisor product of shared irreducible factors (with multiplicities) product of shared primes (with multiplicities)
euclidean division Given LaTeX: A(s), B(s) \neq 0A(s),B(s)0 there exist two unique polynomials LaTeX: Q(s), R(s)Q(s),R(s) with LaTeX: \textrm{deg}R(s) < \textrm{deg}B(s)degR(s)<degB(s) so that LaTeX: A(s) = Q(s)B(s) + R(s)A(s)=Q(s)B(s)+R(s) Given integers: LaTeX: a, b \neq 0a,b0 there exist two unique integers LaTeX: q,rq,r with LaTeX: |r| < |b||r|<|b| so that LaTeX: a = bq + ra=bq+r

2f) Translate 2c-2e to polynomials.

Problem 3

Use Euclid's algorithm to find all solutions to the equation

LaTeX: s^2x(s) + (0.5s + 1)y(s) = 1s2x(s)+(0.5s+1)y(s)=1

where LaTeX: xx and LaTeX: yy are polynomials. Use the results to find a solution to the equation

LaTeX: s^2f(s) + (0.5s + 1)g(s) = (s^2 + 2\zeta_c\omega_c s + \omega_c^2)(s^2 + 2\zeta_o\omega_os + \omega_o^2)s2f(s)+(0.5s+1)g(s)=(s2+2ζcωcs+ω2c)(s2+2ζoωos+ω2o)

such that the polynomials LaTeX: ff and LaTeX: gg have degrees 2 and 1 respectively.

Problem 4

For polynomials LaTeX: A, B, CA,B,C with LaTeX: \textrm{deg}(A) = \textrm{deg}(B) = ndeg(A)=deg(B)=n and unknown polynomials LaTeX: X, YX,Y with degrees LaTeX: n - 1n1.
The Diophantine equation can be posed as a set of linear equations:

LaTeX: \begin{bmatrix}
a_0 & 0  & \ldots & 0 & b_0 & 0  & \ldots & 0 \\
a_1 & a_0 & \ldots & 0 & b_1 & b_0 & \ldots & 0\\
\vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \ddots & \vdots\\
a_{n-1} & a_{n-2} & \ldots & a_0 &  b_{n-1} & b_{n-2} & \ldots & b_0 \\
 a_n & a_{n-1} & \ldots & a_1  & b_n & b_{n-1} & \ldots & b_1 \\
0 & a_n & \ldots &a_2 & 0 & b_n & \ldots & b_2 \\
\vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \ddots & \vdots\\
0 & \ldots & 0 & a_n &  0 & \ldots & 0 & b_n
\end{bmatrix}
\begin{bmatrix}
x_0\\ \vdots \\x_{n-1}\\ y_0 \\ \vdots \\ y_{n-1} 
\end{bmatrix}
=
\begin{bmatrix}
c_0 \\ c_1 \\c_2 \\ \vdots \\c_n \\c_{n+1} \\ c_{n+2} \\ \vdots \\ c_{2n - 1}
\end{bmatrix}[a000b000a1a00b1b00an1an2a0bn1bn2b0anan1a1bnbn1b10ana20bnb200an00bn][x0xn1y0yn1]=[c0c1c2cncn+1cn+2c2n1]

If LaTeX: AA and LaTeX: BB have common factors, what are the left and right null spaces?

Problem 5

Prove that if LaTeX: \lim_{s \to 0} P(s) \neq 0lims0P(s)0, then zero stationary error implies  LaTeX: \lim_{s \to \textcolor{red}{0}} C(s) = \inftylims0C(s)=. (Discuss what assumptions are needed for this statement...)

Problem 6

This exercise compares two ways of introducing integral action into observer-based feedback controllers. Apply your results to

LaTeX: P_2(s) = 50 \frac{(1/5 - s)(s + 5)}{ (1/5 + s)(5 - s) (s + 10)}
P2(s)=50(1/5s)(s+5)(1/5+s)(5s)(s+10)

from exercise 3.1.

Design controllers for LaTeX: P_2P2 and construct code to find the controller polynomials R,S,T for state-feedback controller with observer that includes integral action:

a)  with u = -K\hat x + k_i x_i + k_r r, as in the basic course Ch 8. See Explicit integral state

b) with "input offset estimation", see Disturbance observer

Explicit integral state

The following procedure can be used to introuce integral action. Consider

LaTeX: \begin{aligned}
\dot x & = Ax + Bu \\
y & = Cx
\end{aligned}˙x=Ax+Buy=Cx

Augment the state vector with an extra component

LaTeX: x_i = \int_0^t e(\tau)d\tau= \int_0^t \left(y_r(\tau) - y(\tau)\right)d\tauxi=t0e(τ)dτ=t0(yr(τ)y(τ))dτ.

Taking LaTeX: x_a = \begin{bmatrix} x \\ x_i \end{bmatrix}xa=[xxi], we get

LaTeX: \begin{aligned}
\dot x_a & = \begin{bmatrix} A & 0 \\ -C & 0 \end{bmatrix} x_a + \begin{bmatrix}B \\ 0 \end{bmatrix} u + \begin{bmatrix}0 \\ 1\end{bmatrix}y_r \\
y & = \begin{bmatrix}C & 0 \end{bmatrix}
\end{aligned}˙xa=[A0C0]xa+[B0]u+[01]yry=[C0].

A state-feedback control law LaTeX: u = -K_ax_a + k_r y_ru=Kaxa+kryr then has a natural decomposition into LaTeX: u = -Kx - k_ix_i + k_r y_ru=Kxkixi+kryr.

The state LaTeX: x_ixi is is unobservable from LaTeX: yy, but it's known to the controller, as we construct it causally from the known quantities LaTeX: yy and LaTeX: y_ryr. Typically one uses the controller LaTeX: u = -K\hat x - k_i x_i + k_r y_ru=Kˆxkixi+kryr where LaTeX: \hat xˆx is generated by a Kalman filter. See the figure below.

explicit_integrator.png

Disturbance Observer

The standard observer-based feedback controller is based on modeling disturbances as perturbations to the initial conditions. This model is too simplistic to be useful in practice. The method of introducing an explicit integrator mediates this somewhat, but is limited to precisely integrators. The following allows the engineer to include a large variety of disturbance models into observer-based design methods.

Consider a process that is affected by a disturbance LaTeX: dd, modeled by

LaTeX: \begin{aligned}
\dot x & = Ax + B_u u + B_d d\\
y & = Cx
\end{aligned}˙x=Ax+Buu+Bddy=Cx.

The disturbance LaTeX: dd, is modeled as

LaTeX: \begin{aligned}
\dot w & = A_w w \\
d & = C_w w
\end{aligned}˙w=Awwd=Cww

The matrix LaTeX: A_wAw typically has eigenvalues close to the origin (models constant load disturbances), or on the imaginary axis (models sinusoidal disturbances). The augmented system becomes

LaTeX: \begin{aligned}
\dot x_a & = \begin{bmatrix} A & B_dC_w \\ 0 & A_w \end{bmatrix} x_a + \begin{bmatrix} B_u\\ 0\end{bmatrix} u \\
y & = \begin{bmatrix} C & 0 \end{bmatrix}x_a
\end{aligned}˙xa=[ABdCw0Aw]xa+[Bu0]uy=[C0]xa,

where the augmented state is given by LaTeX: x_a = \begin{bmatrix} x  \\ w \end{bmatrix}xa=[xw]. The state LaTeX: ww is not controllable, but it is observable. We construct the controller asLaTeX: u =  -K\hat x - K_w \hat w + k_r y_ru=KˆxKwˆw+kryr, where LaTeX: \hat x_a = \begin{bmatrix} \hat x \\ \hat w \end{bmatrix}ˆxa=[ˆxˆw] is computed by a Kalman filter. The closed-loop system is described by

LaTeX: \begin{aligned}
\dot x & = (A - B_u K)x + (B_d C_w - B_u K_w)w - B_uK \tilde x - B_u K_w \tilde w\\
\dot w & = A_w w \\
\dot{\tilde x} & = (A - LC)\tilde x +B_d C_w \tilde w \\
\dot{\tilde w} & = A_w \tilde w - L_w C \tilde x
\end{aligned}˙x=(ABuK)x+(BdCwBuKw)wBuK˜xBuKw˜w˙w=Aww˙˜x=(ALC)˜x+BdCw˜w˙˜w=Aw˜wLwC˜x

This method is particularly effective if one can pick LaTeX: K_wKw such that LaTeX: B_d C_w = B_u K_wBdCw=BuKw. Input offset estimation builds on the model LaTeX: y = P(u + d)y=P(u+d), i.e. LaTeX: B_u = B_dBu=Bd. This is sometimes called matched disturbance.

dist_observer.png