0
votes

I am trying to design a Luenberger observer (or a full state feedback observer) such that with one sensor available I can estimate all the states. A good tutorial is shown here.

My system is 4th order:

num = [-0.00198 2];
den = [1 0.1201 12.22 0.4201 2];
sys = tf(num,den);
[A, B, C, D] = tf2ss(num,den);

First I have a row vector of poles to get my desired response:

poles = [-2.6 + 1i*2.39, -2.6 - 1i*2.39, -100, -120];
K = acker(A,B,poles)
rank(obsv(A,C));  % =4
Mo = rank([C;C*A;C*A^2;C*A^3]) % =4

I then proceed to calculate the plant poles and thus the poles I want for my observer should be around 3x faster.

plant = (A-B*K);
poles_cl = eig(plant)

poles = 3*poles_cl  % THIS IS WRONG
des_poles = (min(real(poles_cl))*3)-(1:4); %This is better

des_poles =

 -361.0000 -362.0000 -363.0000 -364.0000

I then proceed to use Ackermann's formula for pole placement using the new poles:

% design observer by placing poles of A-LC at des_poles 
L=acker(A',C',poles_des)'
eig_obs = eig(A-L*C) 

L =

   1.0e+09 *

    8.6121
    0.1037
    0.0005
    0.0000

eig_obs =

 -361.0000
 -362.0000
 -363.0000
 -364.0000

And finally plot. For the observer (software) to give us all the states as output we need to set C = eye(4):

C = eye(4);
mysys=ss(A-L*C,[B L],C,0); %Not sure if this is correct
tf(mysys)
step(mysys)

Four outputs can be seen:

enter image description here

Following this model for a full state feedback observer:

enter image description here

I am then trying to verify the results on Simulink and am having issue with the block diagram. As can be seen I have two state space models, one for the real plant and one for the observer.

In the below diagram I am comparing state 1, which results in the second graph depicted below.

enter image description here

I am using the base workspace generated by the code above:

enter image description here

Upon running I get an output from the observer which does not track or follow the plant as expected:

Actual and Observer states when comparing state 4 through summing block:

enter image description here

Actual and Observer states when comparing state 1 through summing block:

enter image description here

Any suggestions on why the state I choose to compare via the summing block is effecting the observer estimations would be appreciated.


Observer Parameters:

enter image description here

Plant Parameters:

enter image description here

  1. Why does the state which I am comparing, effect the observer response?
1
Your system is going unstable. The first thing to check is that you don't have a + where you should have a -, or vice-versa.Phil Goddard
@PhilGoddard, thanks for your comment. Are you referring to the Simulink diagram or MATLAB code? As far as I can tell, the summing blocks have the correct signs, and so do all the equations presented in the code.rrz0
I was referring to the Simulink diagram. It would also be helpful for you to show the parameters you've entered into the State-space blocks, particularly the observer. One thing strange about your block diagram is that the outputs of the observer x(1)...x(4) are being multiplied by K(4)..K(1), which at least superficially seems like the wrong order.Phil Goddard
Corrected order of K(4) to K(1) and edited question to add further implementation details and parameters inside state-space blocks.rrz0

1 Answers

1
votes

You are not using your closed loop system to determine your observer poles. You want to choose your observer poles faster than your closed loop poles.

Your closed loop A matrix becomes:

Ac = (A-B*K);

and then your closed loop poles become,

poles_cl = eig(Ac);

You can try to make your observer poles 3 or even 10 times faster then these poles, otherwise, and set them based on the (real of the) fastest pole:

factor = 3;
des_poles = (min(real(poles_cl))*factor)-(1:4);
L = place(A',C',des_poles)';

You can play around with the factor, in noisy conditions you may want to use slower poles (i.e. factor lower than 1, since it is based on the fastest pole), to not amplify your noise that much.