I try to implement a state observer (Luenberg Observer) to estimate the speed of my motor. Only the absolute position of the motor can be measured and I want to take into account also the target velocity as the input.
So my derived state space model looks like this:
The states are position, velocity and acceleration $$ x = \begin{pmatrix} p \\ v \\ a \end{pmatrix} $$
The Input is the velocity target vi minus the estimated velocity state:
$$ u=(v_i-v) $$
The system matrices looks like this (T is the sampling time): $$ A = \begin{pmatrix} 1 & T & \frac{T^2}{2} \\ 0 & 1 & T \\ 0 & 0 & 0 \end{pmatrix} $$
$$ B = \begin{pmatrix} T \\ 1 \\ \frac{1}{T} \end{pmatrix} $$
$$ C = \begin{pmatrix} 1 & 0 & 0 \end{pmatrix} $$
$$ D=0 $$
When I move the input -v into the A matrix, it looks like this:
$$ x_{k+1} = \begin{pmatrix} 1 & 0 & \frac{T^2}{2} \\ 0 & 0 & T \\ 0 & -\frac{1}{T} & 0 \end{pmatrix} x_k + \begin{pmatrix} T \\ 1 \\ \frac{1}{T} \end{pmatrix} v_i $$
$$ y_k= \begin{pmatrix} 1 & 0 & 0 \end{pmatrix} x_k $$
So I tried to place the poles of the error dynamics with a Luenberg observer by choosen L for:
$$ A-LC = \begin{pmatrix} 1-L_1 & 0 & \frac{T^2}{2} \\ -L2 & 0 & T \\ -L3 & -\frac{1}{T} & 0 \end{pmatrix} $$
I placed the poles in matlab as follows: $$ |\lambda_i|<1$$ at [-0.5,-0.55,-0.6]
Which gave me for L:
$$ L = \begin{pmatrix} 2.65 \\ 2.92 \times 10^3 \\ -1.9 \times 10^5 \end{pmatrix} $$
So I embedded this observer in the real system, but the results are actually very bad. So I think I did something wrong with the state space model, especially the input u seems not to be a good idea. Has anyone an idea how else I can model this system, especially about the input u I'm very unsure. Should I use the actual current as input for u, since this is proportional to the torque and so the acceleration?
Edit: What i further see is, that state a is not observable (Observability matrix has determinante different from zero), but since I don't want to observe the acceleration (I give this directly as an input), I think this should not be a problem, right?
Edit 2 Well, my Luenberger gains are pretty high, so I think that might be a problem. I update the state as follows:
$$ x_{k+1}=(A-LC)x_k + B v_i + Ly_k $$
y is my measured position at instance k, so let's say this is 4000 (12 bit encode resolution). Initially my states are zero. Then the acceleration will be directly 4000*(-1.9 * 10^5), huge! So I think I really messed up something here.