Look at this picture. This is the seperation principle diagram.
It is an LQG controller which going to control the real life process. What I want to do, is to create a state space model for this seperation principle system, including the real life process. A LQG controller is a LQR controller together with the Kalmanfilter. Kalmanfilter is also called an observer.
The LQR controler is a feedback gain matrix L and the kalmanfilter is just a mathematical description of the real life system with a gain matrix K.
r(t) is the reference signal vector which describe how the system's states should hold e.g. temperature or pressure. y(t) is the output from the real life process. $\hat{y}$ is the estimated output from the kalmanfilter. d(t) is the disturbance vector for the input. That's a bad thing, but the Kalman filter are going to reduce the disturbance and noise. u(t) is the in signal vector to the real life system and the kalmanfilter. n(t) is the noise vector from the measurement tools. x(t) is the state vector for the system. $\dot{x}$ is the state vector derivative for the system. $\hat{x}$ is the estimated state vector for the system. $\dot{\hat{x}}$ is the estimated state vector derivative for the system.
A is the system matrix. B is the in signal matrix. C is the output matrix. L is the LQR controler gain matrix. K is the kalmanfilter gain matrix.
So....a lot of people create the state space system as this: $$ $$ For the real life system: $$ \dot{x} = Ax + Bu + d$$ For the kalmanfilter: $$\dot{\hat{x}} = A\hat{x} + Bu + Ke$$ But $u(t)$ is:
$$u = r - L\hat{x}$$
And $e(t)$ is: $$e = y + n - \hat{y} = Cx + n - C\hat{x} $$
And then...for some reason, people says that the state space model should be model by the state estimation error:
$$\dot{\tilde{x}} = \dot{x} - \dot{\hat{x}} = (Ax + Bu + d) - (A\hat{x} + Bu + Ke) $$ $$ \dot{\tilde{x}} = (Ax + Bu + d) - (A\hat{x} + Bu + K(Cx + n - C\hat{x})$$ $$ \dot{\tilde{x}} = Ax - A\hat{x} + d - KCx - Kn + KC\hat{x} $$ And we can say that: $$\tilde{x} = x - \hat{x} $$ Beacuse: $$\dot{\tilde{x}} = \dot{x} - \dot{\hat{x}}$$ The kalmanfilter will be: $$ \dot{\tilde{x}} = (A - KC)\tilde{x} + Kn$$
The real life process will be: $$ \dot{x} = Ax + Bu + d = Ax + B(r - L\hat{x}) + d = Ax + Br - BL\hat{x} + d$$
But: $$\tilde{x} = x - \hat{x} \Leftrightarrow \hat{x} = x - \tilde{x}$$
So this will result for the real life process: $$ \dot{x} = Ax + Br - BL(x - \tilde{x}) + d = Ax + Br - BLx + BL\tilde{x} + d$$
So the whole state space model will then be:
$$ \ \begin{bmatrix} \dot{x} \\ \\\dot{\tilde{x}} \end{bmatrix} =\begin{bmatrix} A - BL& BL \\ 0 & A-KC \end{bmatrix} \begin{bmatrix} x\\ \tilde{x} \end{bmatrix}+\begin{bmatrix} B & I & 0\\ 0 & 0 & K \end{bmatrix}\begin{bmatrix} r\\ d\\ n \end{bmatrix}\ $$
Youtube example: https://youtu.be/H4_hFazBGxU?t=2m13s
$I$ is the identity matrix. But doesn't need to be only ones on digonal form. $0$ is the zero matrix.
The Question: $$ $$ If I write the systems on this forms: $$ \dot{x} = Ax + Bu + d = Ax + B(r - L\hat{x}) + d$$ For the kalmanfilter: $$\dot{\hat{x}} = A\hat{x} + Bu + Ke = A\hat{x} + B(r - L\hat{x}) + K(y + n - \hat{y})$$ Beacuse $u(t)$ and $e(t)$ is: $$u = r - L\hat{x}$$ $$e = y + n - \hat{y} = Cx + n - C\hat{x} $$
I get this: $$\dot{x} = Ax + Br - BL\hat{x} + d$$ $$\dot{\hat{x}} = A\hat{x} + Br - BL\hat{x} + KCx + Kn - KC\hat{x}$$ Why not this state space form: $$ \begin{bmatrix} \dot{x} \\ \\\dot{\hat{x}} \end{bmatrix} =\begin{bmatrix} A & -BL \\ KC & [A-BL-KC] \end{bmatrix} \begin{bmatrix} x\\ \hat{x} \end{bmatrix}+\begin{bmatrix} B & I & 0\\ B & 0 & K \end{bmatrix}\begin{bmatrix} r\\ d\\ n \end{bmatrix}\ $$ Youtube example: https://youtu.be/t_0RmeSnXxY?t=1m44s
Who is best? Does them both works as the LQG diagram shows? Which should I use?