# Is this a LQGI controller - Linear Quadratic Gaussian Integral regulator

I want to make sure that I have done it right.

First of all, I going to show how I think the state space representation whould look like:

The System: $$\dot{x} = Ax + Bu + I_dd$$ $$y = Cx + I_n n$$

Where $I_n$ is the identity matrix for the noise and $I_d$ is the identity matrix for the disturbance. For SISO system $I_n = 1$

The LQE: $$\dot{\hat{x}} = A\hat{x} + Bu + Ke$$ $$\hat{y} = C\hat{x}$$ $$e = y - \hat{y} = Cx + I_n n - C\hat{x}$$

The LQR: $$u = -L\hat{x} + L_i x_i$$

The LQI: $$\boxed{\dot{x_i} = I_r r - y = I_r r - Cx - I_n n}$$ $$x_i = \int_{0}^{t} (I_r r- y)dt = \int_{0}^{t} (I_r r - Cx - I_n n)dt = \int_{0}^{t} = \dot{x_i} dt$$

Where $I_r$ is the identity matrix for the reference signal. For SISO system $I_r = 1$

Assume that: $$\tilde{x} = x - \hat{x} \rightarrow \tilde{x} - x = - \hat{x}$$

Inserting that in LQR results the new $u$: $$u = -L\hat{x} + L_i x_i \rightarrow L\tilde{x} - Lx + L_i x_i$$

Inserting the new $u$ in System results: $$\dot{x} = Ax + B(L\tilde{x} - Lx + L_i x_i) + I_dd$$ $$\dot{x} = Ax + B L\tilde{x} - BLx + B L_i x_i + I_dd$$ $$\boxed{\dot{x} = (A- BL)x + B L\tilde{x} + B L_i x_i + I_dd}$$

Inserting new $u$ and $e$ in LQE results: $$\dot{\hat{x}} = A\hat{x} + B(L\tilde{x} - Lx + L_i x_i) + K(Cx + I_n n - C\hat{x})$$ $$\dot{\hat{x}} = A\hat{x} + B L\tilde{x} - B Lx + B L_i x_i + K Cx + KI_n n - K C\hat{x}$$ Assume that: $$\dot{\tilde{x}} = \dot{x} - \dot{\hat{x}}$$

That means: $$\dot{\tilde{x}} = [Ax + B L\tilde{x} - BLx + B L_i x_i + I_dd] - [A\hat{x} + B L\tilde{x} - B Lx + B L_i x_i + K Cx + KI_n n - K C\hat{x}]$$ $$\dot{\tilde{x}} = Ax + B L\tilde{x} - BLx + B L_i x_i + I_dd - A\hat{x} - B L\tilde{x} + B Lx - B L_i x_i - K Cx - KI_n n + K C\hat{x}$$ $$\dot{\tilde{x}} = Ax + I_dd - A\hat{x} - K Cx - KI_n n + K C\hat{x}$$

But remember that: $$\tilde{x} = x - \hat{x}$$

Will give us: $$\dot{\tilde{x}} = Ax + I_dd - A\hat{x} - K Cx - KI_n n + K C\hat{x}$$ $$\dot{\tilde{x}} = A(x - \hat{x}) + I_dd - KC(x -\hat{x}) - KI_n n$$ $$\dot{\tilde{x}} = A\tilde{x} + I_dd - KC\tilde{x} - KI_n n$$ $$\boxed{\dot{\tilde{x}} = (A - KC)\tilde{x} + I_dd - KI_n n}$$

Result: The whole state space representation will be:

$$\begin{bmatrix} \dot{x}\\ \dot{\tilde{x}}\\ \dot{x_i} \end{bmatrix} = \begin{bmatrix} A-BL & BL & BL_i \\ 0 & A-KC & 0\\ -C & 0 & 0 \end{bmatrix} \begin{bmatrix} x\\ \tilde{x}\\ x_i \end{bmatrix}+\begin{bmatrix} 0 & I_d & 0\\ 0 & I_d & -K I_n\\ I_r & 0 & -I_n \end{bmatrix}\begin{bmatrix} r\\ d\\ n \end{bmatrix}$$

$$y = \begin{bmatrix} C & 0 & 0 \end{bmatrix}\begin{bmatrix} x\\ \tilde{x}\\ x_i \end{bmatrix} +\begin{bmatrix} 0 & 0 & I_n \end{bmatrix}\begin{bmatrix} r\\ d\\ n \end{bmatrix}$$

Questions:

1. Am I wrong or Am I right? Is this the Linear Quadratic Gaussian Integral regulator?
2. Is there any way to compute the integral gain matrix $L_i$ by using Algebratic Riccati Equation (ARE)?
3. Will this regulator remove the steady state error?
4. What is the transfer function for this state space?
• 1 - Just taking a quick look, it seems fine. 2 - You can calculate de integral effect gain trought an ARE, what you will get is an extended gain matrix in which some columns of it are the feedback gain and the remaining columns are the integral gain. 3 - This regulator should be able to eliminate the steady-state error, because of the LQI. – bertozzijr Jul 11 '17 at 14:02
• Also, refer to my question about extended state-spaces for integral action (math.stackexchange.com/questions/2300177/…) – bertozzijr Jul 11 '17 at 14:05
• Thanks! That was fast! Can I use the same lqr() command from MATLAB to compute $L_i$ as I do with the control law $L$ ? Just changing the $Q$ and $R$ weighting matrices? – Daniel Mårtensson Jul 11 '17 at 14:06
• @DanielMårtensson If you are using MATLAB, then why not use lqi()? – Kwin van der Veen Jul 11 '17 at 19:15
• @DanielMårtensson fibonatic's suggestion is also good. But indeed, you can use Matlab's lqr() to compute the gain. Just make sure to use matrices A,B,C and Q correctly (regarding extended state-space) – bertozzijr Jul 11 '17 at 19:48

Due to certainty equivalence you can split the observer and feedback control up into two separate problems. So the full state observer can indeed be found using a Kalman filter/LQE. For the control LQI can be used, which tries to minimize

$$J(u) = \int_0^\infty \left[z^\top(t)\,Q\,z(t) + u^\top(t)\,R\,u(t) + 2\,z^\top(t)\,S\,u(t)\right] dt, \tag{1}$$

with $z(t) = \begin{bmatrix}x^\top(t) & x_i^\top(t)\end{bmatrix}^\top$ and $x_i(t)=\int (r-y)dt$. So using the standard state space model (without the feed through matrix $D$) and augmenting the state space yields

$$\begin{bmatrix} \dot{x} \\ \dot{x}_i \end{bmatrix} = \begin{bmatrix} A & 0 \\ -C & 0 \end{bmatrix} \begin{bmatrix} x \\ x_i \end{bmatrix} + \begin{bmatrix} B \\ 0 \end{bmatrix} u. \tag{2}$$

The combined optimization problem using $(1)$ and $(2)$ can just be solved with LQR. However I am not entirely sure myself why your are allows to disregard the reference input from $(2)$.

• That's not LQGI. That's LQI. – Daniel Mårtensson Oct 30 '17 at 18:38
• @DanielMårtensson I do indeed mainly talk about finding the feedback gain from the LQI problem (so how to find your $L$ and $L_i$). However as stated at the beginning of my answer due to certainty equivalence you can split up finding the observer and feedback gain. I am not sure if there is a clear definition for LQGI, because you could also use $x_i = \int(r-\hat{y})\,dt$, so $\hat{y}$ instead of $y$. – Kwin van der Veen Oct 30 '17 at 20:00
• So you mean that I could only use one row of the kalman gain or control law gain matrix? – Daniel Mårtensson Oct 31 '17 at 18:00
• @DanielMårtensson I am not sure what you mean, what do you want to use that row for? Are you referring to $L_i$? In that case you can use the first column of the control law gain matrix. – Kwin van der Veen Oct 31 '17 at 18:20
• For an example. If I want to compute the control Law, a.k.a LQR gain matrix. In MATLAB/Octave I can do this: $$L = lqr(A, B, Q, R)$$. And if I want to compute the kalman gain matrix, a.k.a LQE gain matrix. I use $$K = (lqr(A', C', Q, R))'$$ Notice that find the transpose of the LQR matrix to turn it vertical. What if I don't do that, then I would find a gain matrix for the $y$ outputs? So LQI gain matrix would simply be: $$L_i = lqr(A', C', Q, R)$$ – Daniel Mårtensson Oct 31 '17 at 18:25