/LQR-controller_state-observer-

Comparison between the State-feedback and LQR controller + the State observer

Primary LanguageMATLAB

LQR Controller with State Observer

Introduction to LQR Control Theory The Linear Quadratic Regulator (LQR) is an optimal control method that stabilizes systems while minimizing a specific cost function. It balances performance (state deviation) and control effort (energy use) through matrices 𝑄 and 𝑅, which adjust the penalties on state errors and control inputs. For the LQR to function effectively, the system must be controllable, meaning it can reach any state using available inputs.

System Dynamics LQR works with systems represented in a state-space model, capturing dynamics through matrices 𝐴, 𝐵, 𝐶, and 𝐷. The control law 𝑢=−𝐾𝑥 is computed with MATLAB’s lqr() function to achieve optimal control performance.

State Estimation(Observer Design) For systems where not all states can be measured, a state observer estimates missing states based on output and known dynamics. Observers such as the Luenberger Observer infer unmeasured states in real-time, enabling the control system to operate accurately. Observability is critical since it ensures that all states can be inferred from system outputs. Also, the gain matrix (G) is adjusted to make the observer's estimated states converge rapidly to the actual system states.

Combining LQR Controller and State Observer The LQR controller and state observer combination is essential for controlling systems with unmeasured states. The observer estimates the full state vector, including any unmeasured states, using the system’s outputs and known dynamics, while, LQR Controller uses the estimated states to compute the optimal control inputs, achieving stable, cost-efficient performance.

System Implementation Steps

Step 1: System Controllability Verify controllability through matrix rank analysis.

Step 2: Control Law Design Calculate the control law with:

[K, S, CLP] = lqr(A, B, Q, R);

Step 3: Stability Check Confirm stability by examining closed-loop poles.

Observability Check: Verify observability for the system.

Pole Selection: Choose faster poles for the observer dynamics.

Comparison between the State-feedback and LQR controller + the State observer

Consider the following system image

The state equations of the system can be represented as: image

The stationary state-feedback control law and the infinite horizon cost function are defined as:

image

where

image

Step1- Check the system controllability:

rank([B BA])=2 ⟹full rank ⟹system is controllable

Step2- Designing the control law

By using Matlab software, we can design the control law by the following command: [K, S, CLP] = lqr (A, B,Q,R);

By achieving the controller gain (K), the control law and the result of the Reccati equation are obtained as follows: image

Step3- checking the control stability

In order to be sure about the stability of the closed-loop system, we have to put the designed controller in the steady-space model and determine the new transition matrix as follows: image

Therefore, all closed-loop poles are located on the left side with negative values. Finally, we can conclude that the closed-loop system is asymptotically stable.

State Observer:

Now assume that the state of the system is not fully accessible (but only the output y is). We will design an asymptotic observer of the state choosing the poles of the observer so that the observer dynamics are considerably “faster” than the dynamics of the original closed-loop system (e.g., ensuring that the time constants of the observer are an order of magnitude smaller than those of that system).

Step1: Checking the observability of the system by using the observation matrix:

rank([C; CA])=2 ⟹full rank ⟹system is Observable

Step2: Determining the desired poles

Desired poles are subject to having faster dynamics than the original ones. Therefore, we choose the desired poles as: Obs_Dpoles =[-10 -15];

Step3: Designing the observer gain

The observer based on the desired poles chosen, by using the following command: G= place (A', C', Obs_Dpoles) ';

Finally, in order to determine the stability of the designed observer, the eigenvalues of the matrix (A-GC) should have negative values.

image

Therefore, the designed observer is asymptotically stable. image

Feedback controller and the state observer

image

By considering the control law structure as:

image

Then by substituting the control law in both state equations, we have: image

Resuls:

image

image

For a sinusoidal input with a frequency equal to 1 rad/s, the system magnitude is equal to -35 dB, and the system phase is -19 deg. 10 rad/s, the system magnitude is equal to -47 dB, and the system phase is -121 deg. 100 rad/s, the system magnitude is equal to -85 dB, and the system phase is -174 deg. As we can see from the bode diagram, there is a huge damping to the incoming signal which is considered as the sinusoidal signal. The behavior of the system can be assumed as a low-pass filter.