Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ELEC4632 Lab 3

Design of state feedback control with observer  for both regulation and set-point control (Output feedback control)

In this lab, you are going to design a control system for your identified model of W-T system and simulate it using MATLAB and Simulink. You have to design state feedback control with observer using trial-and-error approach, and then examine the designed control system in terms of the following control system characteristics,

▪    Stability in both regulation and set-point tracking

▪   Acceptable transient response (rise time and overshoot) and steady-state response (settling time and steady-state error)

▪    Disturbance rejection

▪    Robustness against parametric uncertainty

▪    Bounded control input signal within the linear input range obtained in Lab 2

This assignment is designed to examine your knowledge on discrete-time state space systems topic in theory and simulation. This includes analyzing stability and verifying the performance of your designed control system under different circumstances such as external disturbances and model parameter uncertainty. You must study your lecture notes on Pole Placement Design” and “Digital Control System Characteristics” . Any other resources that would be needed for this lab will be provided in this Lab note. You are also encouraged to explore different resources if needed.

Throughout this Lab, you must use your identified linear discrete-time model you obtained in Lab 2 from  a W-T  setup.  Note  that  all the  simulations  and  control  system  requirements  should  be considered for offset-free  model,  including control  input  range,  initial conditions, and set-point values.

This  lab  is  conducted  remotely  through  Microsoft  Teams  for  online  lab  students. The lab exercise does not require the use of the actual water tank system in the lab. Therefore, it is recommended to do all MATLAB tasks on your computer.

Pre-lab Exercise

Answer the following questions and  provide  MATLAB codes and  results  using your  identified model parameters you obtained in Lab 2.

1.   Recreate transfer function and state space models of your identified model as you did in Lab 2. Then, find system eigenvalues and determine whether the open-loop system is stable or not.


Also, find the zero of the system using zero function in MATLAB. Is your identified system a minimum phase system (stable zero)?

Note: Recall that the transfer function and the canonical controllable state space form can be

defined using the identified model parameters as below,

▪   Transfer function in Z domain:

G(z) = = = .

▪    Canonical controllable state space form in discrete-time:

G = , H = 1(0), C = [b2

b1 ], D = 0.

(1)

(2)

where U(z)/u(k) is offset-free input voltage of the pump, which is called control input, and Y(z)/y(k) is the offset-free output (offset-free water level).

2.   Is the system reachable and controllable, and, observable and detectable?

3.   Use  the Duality property  between  controllability  and  observability  and  find  the canonical observable form of the state space model.

Hint: If a state space system is describes by matrices {G, H, C, D}, the Dual system is defined by {GT, CT, HT, DT}. One result of this property is that if a pair (G, H) is reachable, then the pair (GT, HT) is observable. Also, if the pair (G, C) is observable, then the pair (GT, CT) is reachable. Therefore, if you use canonical controllable form given in Eq. (2) to create your state space representation in question 1, you can use this property to find the canonical observable form.

Lab Exercise (2 marks)

1. Regulation by state feedback (0.6 marks)

a.  Choose the initial conditions for your system model, i.e., x(0) = [x1(0) x2(0)]T such that the

initial value of the offset-free output is equal to 0.3, i.e., y(0) = Cx(0) = 0.3. (0.15 marks)

Note: Recall that the output (water level) is measured by a pressure sensor that generates a voltage signal in the range of 0-5 volts corresponding to water levels between 0-300ml. If the  sensor  is  working  linearly  with  no  y-axis  intercept,  you  can  consider  the sensor conversion rate as 5/300 V/ml or 300/5 ml/V, which enables you to convert any sensor voltage value to the corresponding water levels  in millilitre.  For instance,  if the sensor measures 2.5V for output, that means the actual water level is  150ml.  In the identified linear model, however, the output, y(k), is the offset-free output in volts which is defined as a linear combination of states in state space form, i.e., y(k) = Cx(k). Thus, x(0) should be chosen such that the actual output remains in-between the linear output range we specified in Lab 2, thus satisfying the following inequality,

80ml 共(y(0)+y_offset) 共240ml.                                                                                    (3)

However,  since  the  system  states  in  canonical  controllable  form  are  not  necessarily physical  quantities  (y(k)  = b2x1(k)  + b1x2(k)),  it  makes  more  sense  to  use  canonical observable form for choosing initial conditions for a specific initial offset-free output value because in canonical observable form we have y(k) = HTx(k) = [0 1]×[x1(k) x2(k)]T= x2(k).


Thus, it is suggested to use canonical observable form of the state space model from now on.

b.  After finding  the  initial  conditions  in  the  previous  question  (Q1.a),  calculate  two  state feedback  gains  (L)  if the  control  input  is  given  as follows  (known  as state feedback control law),

u(k ) = −Lx(k).                                                                                                                            (4)

One feedback gain for deadbeat control and name it L_db, and another feedback gain for non-deadbeat control and  name  it  L_ndb.  For  non-deadbeat  feedback  gain   L_ndb, closed-loop eigenvalues should be chosen such that it ensures stability of the closed-loop system with fastest possible response without exceeding your control input limits (offset- free input voltage range you obtained in Lab 2, umin ≤ u(k) ≤ umax). You can use place or acker functions in MATLAB or directly apply Ackerman Formula to find feedback gains. (0.15 marks)

Hint: The closer the closed-loop eigenvalues to the origin, the higher the control input amplitude would be. This means that having small closed-loop eigenvalues would lead to a faster response, and accordingly, higher control input. However, since any real system has constraint on the amplitude of its control input, we have to accept a compromise between an  ideal  system  response  (deadbeat control)  and  maximum  accessible  control  input amplitude. This requires you to simulate the closed-loop system and check its control input u(k) to make sure that your choice of closed-loop eigenvalues is suitable. For regulation by state feedback, you can choose your closed-loop eigenvalues to be close to the open-loop ones to prevent violation of control input limits.

c.   Simulate  the  two  closed-loop  control  systems,  and  plot  the  outputs  (initial  condition responses)  and control  inputs.  For example, the  results of deadbeat control and  non- deadbeat  control  for  the  model  obtained  from  SysIdenData_StudentVersion.mat data  (Lab  1)  are  shown  in Fig.  1 with the  closed-loop  eigenvalues  [0.4  0.9] for  non- deadbeat control and canonical observable form of the state space model. You can see that deadbeat control input inFig. 1(b) is way over the control input limit of ±0.5V. You can use  initial or  lsim functions  to  simulate the  closed-loop  systems  in  MATLAB,  or alternatively, you can use Simulink (0.3 marks).

Fig. 1. Initial condition responses and control inputs, (a) Output responses, (b) Control input signals .


2. Set-point control (0.7 marks)

The structure of the set-point control system using state feedback approach is illustrated inFig. 2. The objective of set-point control is to design a control system such that the output follows some specific constant reference output values, i.e., y(k) yref(k) as k . Thus, the control law for this task using state feedback approach is given as follows,

y(k)

+ Z 1


Fig. 2. Block diagram of set-point control using state feedback approach and DC gain compensation .

u(k) = −Lx(k) + Gcl(−)1(1)yref (k),

(5)

where Gcl1(z)|z=1  is the inverse of the DC gain of the closed-loop transfer function and yref(k) is the reference or desired output  (refer to lecture notes on how to find closed-loop transfer function from closed-loop state space system). The addition of Gcl1(1)yref(k) to the control input in Eq. (5) is to compensate for a steady state error that is created due to the structure of control law in Eq.(5) (refer to Tutorial 7, Question 3). Now, follow the steps below for this part of lab exercise.

a.   Find a non-deadbeat feedback gain for set-point control (similar to regulation) such that the output can follow a reference signal yref(k) = {0, 0.7, -0.2, 0.5, 0} with the period for each level to be  140×0.75 =  105sec, as fast as possible without exceeding the control input limits.  Note  that yref(k)  has  the  same  unit  as  system  output  (offset-free  water  level measured  in volts).  Similar to the  choice of  initial  conditions, these  levels  have to  be chosen to be consistence with the actual output constraints as given in Eq(3), i.e., 80ml ≤ (yref(k) + y_offset) 300/5 ≤ 240ml.  Furthermore, you cannot expect to design a state feedback gain to fill the tank to  its  maximum  level faster than  its settling time without violating control input constraints. Thus, you should have a reasonable view on how fast” you want your control system to change water level and how much when you choose desired levels for yref(k). (0.2 marks)

b.  Simulate the closed-loop system with zero initial conditions to verify your feedback gain and control system design. Plot the output response with reference output and control input similar toFig. 3. This figure shows the results of the same set-point control in this exercise for the example model obtained from  SysIdenData_StudentVersion.mat data with closed-loop eigenvalues of [0.92 0.92]. You can use dcgain function to find DC gain of the closed-loop transfer function, or directly calculate it. You can use lsim function to simulate your  system  or  build  the  model  in  Simulink.  Comment  on  transient  and  steady-state responses (0.5 marks)

Fig. 3. Set-point control response, (a) Output response compared with reference output, (b) Control input .

3. Output feedback control (Set-point control with observer) (0.7 marks)

a.  Suppose that you are only able to measure the output not the states. Design a deadbeat observer and find matrix gain K (refer to Tutorial 7 Question 1.c). You can either directly calculate observer gain using Ackerman formula, or use similar functions as for feedback gain in MATLAB to find observer gain using Duality property, i.e., find feedback gain for the pair of (GT, CT) and then transpose it. (0.2 marks)

b.  Simulate the complete output feedback control system for set-point control with deadbeat observer as shown in Fig. 4 using the same reference signal you have constructed in previous exercise and the same non-deadbeat controller (Q2.a and Q2.b). Use the same initial conditions as for regulation exercise (Q1.a) to verify your observer behaviour in the first period. Plot closed-loop output response with reference signal, input signal, and state estimation error (i.e., x(k) – (k)) similar toFig. 5(plot state estimation error for only the first

3 seconds). Fig. 5 shows the results of the output feedback control in this exercise for the example model obtained from SysIdenData_StudentVersion.mat data with closed- loop eigenvalues of [0.9 0.9], deadbeat observer, and initial output of y(0) = 0.3. Comment on transient and steady-state responses.  How many time steps at most would take for state estimation error to reach zero in general?(0.5 marks)



Fig. 4. Block diagram of the output feedback control system with observer.

Fig. 5. Set-point control response with observer and non-zero initial conditions, (a) Output response compared with

reference output, (b) Control input, and (c) State estimation error.

Post-lab Exercise

1. Disturbance rejection

x(k + 1) = Ax(k) + Bu(k) + Wd(k),                                                                                                    (  )6

where d(k) is input disturbance and W is the disturbance matrix. You can choose a unit step signal for d(k) with a delay (for example after 100 seconds) and W = [0.5 0]T.

a.   Examine the  effect  of disturbance  acting  on the  input for set-point  control  using  non- deadbeat feedback control as you designed in lab exercise 2. Comment on the ability of state feedback control in disturbances rejection by plotting the simulation results similar to Fig. 3.

b. Optional as Bonus: Is it possible to consider any value for input disturbance? What could be viewed as a source of input disturbance in the actual W-T system?

c. Optional as Super Bonus:  Can you design a state feedback control  law such that  it eliminates the effect of constant disturbance assuming that only output can be measured? (refer to Tutorial 7 Question 1.c and show your simulation and worked-out solution)

2. Robustness analysis

When dealing with model uncertainty, it is assumed that the model for which the controller is designed ( Gˆ(z)) is slightly different with the actual model of the process (Greal(z)). For instance,

5% uncertainty for a second-order discrete-time model can be described as follows,

G(z)real = , Gˆ(z)  = ,

for i = 1, 2.

(7)

where {1, 2 , 1, 2 }  are the estimated parameter of the identified linear model (the parameters

you have already calculated in Lab 2). To simulate the effect of uncertainty, you can design the

feedback gain according to estimated model Gˆ(z) , which you already did in lab exercise2, and

then use that feedback gain for Greal(z) (they can be expressed in state space from too).

a.   Examine  robustness of the control system  by adding  uncertainty to the system  model parameters by up to 5% for set-point control using non-deadbeat state feedback controller as you designed in lab exercise2. Remember that you DO NOT need to change feedback gain. Only apply the same feedback gain to the modified system model. You can use rand function in MATLAB as you used in Lab 1 pre-lab exercise to generate random numbers between ±0.05, and then create new model parameters that satisfy the inequality in Eq.(7). Comment on the ability of state feedback controller in robust behaviour against uncertainty by plotting the simulation results similar toFig. 3.