Integrate all estimated states from a LQG controller?

103 Views Asked by At

I'm trying an expriment right now. I want to integrate all estimated states from a LQG controller. A LQG controller is a linear time domain controller which have proportional state feedback with filter for noise.

The LQG can estimate all the states from just one states. That's mean that I can know every velocity and deplacement in the system, just by looking at one velocity or one deplacement e.g a shaft position or a cylinders speed.

And of course! The LQG have a kalman filter. It's a optimal estimator which also reduce noise from measurement.

Here is a diagram of a LQG controller:

  • A = System matrix.
  • B = Signal matrix.
  • C = Output matrix.
  • K = Kalman gain matrix (The LQE controller)
  • L = Control law matrix (The LQR controller)
  • $\frac{1}{s}$ = Integrator
  • $\dot{\hat{x}}$ = Estimated derivative state
  • $\hat{x}$ = Estimated state
  • $\dot{x}$ = Derivative state
  • $x$ = State
  • $ym$ = Measured output
  • $ye$ = Estimated output
  • $r$ = Reference signal
  • $u$ = Signal

enter image description here

To do this. Just simulate this MATLAB / Octav code

dt = 1;
t = 0;
for i = 1:1000
  % State space model
  dx = A*x + B*u; % Compute the dx
  % Observer
  destx = A*estx + B*u + K*(C*x - C*estx); % Cx = ym, C*estx = ye
  % Compute the signal
  u = - L*estx + r;
  % Store the states in Y - Plot it later
  Y(i, :) = [t, x'];

  % Compute the next state by using integrator
  x = x + dx*dt;
  estx = estx + destx*dt;
  % Time
  t = t + dt;
endfor

But how would the code look like if the LQG looked like this:

  • $N$ - Integrator gain matrix (The LQI controller)

Beacuse the LQG is just a simple "P-controller". And if the system have states with velocity (most of the time), the LQG controller is going a "PD-controller". Just because the $L$ matrix is just a matrix with real numbers.

So what do I need to add in the code to make the LQG have integral action?

enter image description here

Edit: Can this be the right method?

dt = 1;
t = 0;
for i = 1:1000
  % State space model
  dx = A*x + B*u; % Compute the dx
  % Observer
  destx = A*estx + B*u + K*(C*x - C*estx); % Cx = ym, C*estx = ye
  % Compute the signal
  u = - L*estx + r - N*intestx; % <-- Added "N*intestx"
  % Store the states in Y - Plot it later
  Y(i, :) = [t, x'];

  % Compute the next state by using integrator
  x = x + dx*dt;
  estx = estx + destx*dt;
  intestx = intestx + estx*dt; % <-- intestx = integrate estimated x 
  % Time
  t = t + dt;
endfor

What do you think about integrating estimated states? Good or bad thing to do?

Here is an LQG example without integral action

enter image description here

Here is an LQG example with integral action

enter image description here