# How to find the reference gain for a LQG controller with integral action?

I'm focusing on practical control engineering and I love to read articles/papers and books about people how tried to take control theory and apply that onto control engineering.

My biggest interest is adaptive control. Unfortunately, adaptive control is not used as practical control engineering due to the danger of letting the controller estimate a model online. Wrong model can result instability. Also adaptive control requires lots of knowledge about the system before a adaptive controller can be applied. In my opinion, that makes adaptive control theory not adaptive at all.

So I had to take one step back and go back to the offline control tuning, e.g Model Predictive Control, PID control or Linear Quadratic Control. I want to use model based control, so PID control is not an option here for me. I'm going to implement the controller onto a 3-5\$ USD microcontroller chip and Model Predictive Control requires a better controller, trust me, I have tried matrix algebra and optimization onto a low RAM micro controller. That does not work. Besides, without quadratic programing and constrains, there is few reason to select a MPC controller over a LQR controller. That leaves me left with the Linear Quadratic Control option.

Linear Quadratic Control minimize a cost function

$$J = \sum^\infty (x^TQx + u^TRu)$$

In this case, I want to use the infinite horizon Linear Quadratic Control. MATLAB/Octave command lqr(A,B,Q,R) or dlqr(A,B,Q,R)

Having a LQR controller requires also that you have a model too. For me, I never build a model of a system by using paper and pen. I use measurement data and use subspace identification methods to estimate an over fitted model which means that the models can handle delays internally. My favorite methods are N4SID for data with much noise, MOESP for data with less noise, OKID for small amount of data and less noise and ERA if you have an impulse response e.g structure element. Those commands can be used from MataveID

The only problem with subspace identification is that you have no information about your state vector $$x$$. You only know the dimension of it. Not which state represent which velocity or position. To solve this issue, you have to use a linear kalman filter, or called Linear Quadratic Estimator. There is a LQE command in MataveControl that computes he kalman gain matrix $$K$$.

So that means I'm in need of an observer with my LQR controller. This controller will now be labeled as Linear Quadratic Gaussian controller - LQG, because of the observer.

I have been talked a lot of university doctors, professors and studens and they have always recommended me to include integration into the model, for better tracking of the reference. Even if there is told that integration is only required for slow systems, but in practical point of view integral action is necessary if tracking is important. One scenario where I think integral action is not important at all is flying drones.

Anyway! LQG with integral controller. Is that possible? Assume that we have our state space model, estimated from the subspace identification methods. I put a hat $$\hat {(.)}$$ over a matrix to mark that the matrix is estimated from data.

$$x(k+1) = \hat Ax(k) + \hat Bu(k)$$ $$y(k) =\hat Cx(k) + \hat Du(k)$$

I begin to estimate my kalman gain matrix $$K$$ from that model. Now I have my state update observer.

$$\hat x(k+1) = \hat x(k) + K(y_m(k) - \hat Cx(k))$$

In face you don't know what Kalman Filter is. A kalman filter is just a description of the system that you simulate online, meanwhile you control the system. The state update equation above just adjust the error. If output measurement $$y_m(k)$$ is equal to estimated $$\hat Cx(k)$$, that means we have a perfect description of your system. If not, then our $$K$$ gain matrix is going to adjust our state updater equation.

After getting the observer done, I need to put some integral action into my model. Notice that this is the discrete method to include integral action.

$$A^* = \begin{bmatrix} A & 0\\ -C & 1 \end{bmatrix}$$

$$B^* = \begin{bmatrix} B\\ -D \end{bmatrix}$$

From that, I can finally compute my control law $$u(k) = -L\hat x(k) + l_{n+1}x_{n+1}$$ $$x_{n+1} = \sum^k_{k=0} [r(k) - y_m(k)]$$

Where $$L$$ is the LQR control law and $$l_{n+1}$$ is the integral control law. The command to compute these control laws is still from the MATLAB/Octave command lqr. By using the matrices $$A^*$$ and $$B^*$$, the output of lqr is going to get an extra column $$l_{n+1}$$ or more depending on the dimension $$n$$ of $$\hat C$$ matrix.

There is also a command in MataveControl that can compute the LQR contol law and the extended integral control law from [L, Li] = lqi(sys, Q, R)

Notice that the measured output $$y_m(k)$$ does not need to be filtered due to the summation.

Question:

By using a reference gain $$K_r$$ multiplied with the reference vector $$r(k)$$, this can even more give a better tracking because the reference gain make sure so the steady state follows the reference $$r(k)$$. I know that the integral action will minimize the steady state errors, but a reference gain $$K_r$$ will help so the integral don't need to grow so large.

So how can I find the reference gain for a LQG controller with integral action?

• What is your question? – SampleTime May 25 at 10:48
• @SampleTime Sorry! I had forgot that. I have updated now my post. Thank you. – Daniel Mårtensson May 25 at 10:50
• Sorry, but it seems that your very long question is not really clear. – Arastas May 26 at 21:11
• @Arastas you know what the reference gain is ? – Daniel Mårtensson May 27 at 8:04
• It would be helpful if you write the complete state-space model of your system in matrix form in the closed loop. Write the steady-state algebraic equation for your system and find what is the steady-state value of the integrator, it should b proportional to the reference (I assume here that the reference is constant). Then apply this value as your "reference gain" as a summation at the output of your integrator. Should work, if I properly understand your question. – Arastas May 27 at 8:35