CY4A2 Advanced System Identification
Lecture 5
SELF-TUNING REGULATORS The development of a control system involves many tasks such as modelling, design of the control law, implementation and validation. The self-tuning regulator (STR) attempts to automate several of these tasks.
Specifications
Controller design
Process parameters
Estimation
Controller parameters Command signal uc
Control signal u
Controller
Dr. V.M. Becerra
Self-tuning regulator
Output y
Process
1
CY4A2 Advanced System Identification
Lecture 5
The Self Tuning Regulator is composed of two loops • The inner loop, which contains the process and an
ordinary feedback controller. • The outer loop, which is composed by a recursive
parameter estimator and design calculations. This loop adjusts the controller parameters Indirect adaptive algorithm: two steps: (1) estimate process model parameters; (2) update controller parameters as if estimates were correct (The Certainty Equivalence Principle)
Out of the several possible parameter estimation techniques we will use the Recursive Least Squares algorithm. Out of several possible controller design methods we will study LQ tracking optimal control, using state space models.
Dr. V.M. Becerra
2
CY4A2 Advanced System Identification
Lecture 5
LQ tracking optimal control design
System model:
x(k +1) = Ax(k) + u(k) y( k) = Cx( k) where x is the state vector, u is the input vector , k is an integer discrete time index , A, B and C are matrices. Performance Index: ∞
J = ∑(( y(k)−u )T Q( y(k )− u )+ u(k )T Ru(k )) c c 1 2
k=0
where J is a scalar performance index, Q is a positive semi-definite matrix, R is a positive definite matrix, and the command signal uc is assumed to be constant. The optimal control sequence that minimises J is:
u(k) = − K f x(k) + K ruc
Dr. V.M. Becerra
3
CY4A2 Advanced System Identification
Lecture 5
where the feedback gain matrix K f is given by
K f = (
T
S + R)−1
T
SA
where S is the solution to the algebraic Riccati equation
S = A T [ S −S (
T
+ R)
S
−1
T
S ] A +Q
The feed-forward gain matrix K r is given by:
Kr = (
T
SB+ R)−1
[ − ( A−
T
K f )T ]−1 CT Q
Questions: • When is there a bounded solution S to the algebraic
Riccatti Equation?
• When is the closed loop plant asymptotically stable?
Dr. V.M. Becerra
4
CY4A2 Advanced System Identification
Lecture 5
Answer : (A,B) should be stabilizable under linear state
e
j
feedback and A, Q should be observable. The ARE can be solved by different methods, such as the iteration method, the eigenvalue method, etc. In Matlab, the following command can be used to obtain K f and S
[Kf, S] = dlqry( A, B, C, D, Q, R)
Dr. V.M. Becerra
5
CY4A2 Advanced System Identification
Lecture 5
Finding the state space model
We intend to use the Recursive Least Squares algorithm for our self tuning controller. Assume, for simplicity, that the system is single-input single-output Assume that the following ARX model structure is used by the Recursive Least Squares algorithm:
A*( q−1 ) y( k) =
*
( q−1 )u( k) + ( k)
where
A*( q−1 ) =1 + a1 q−1 ++ ana q−na B*( q−1 ) = b1 q−1 + b2 q−2 ++ bnb q−nb
Dr. V.M. Becerra
6
CY4A2 Advanced System Identification
Lecture 5
An equivalent non-minimal state space realization of the above ARX model is given below.
x(k +1) = Ax(k) + u(k) y( k) = Cx( k) + ( k)
where the state vector is defined as:
x(k) = [ y(k) y(k −1)y(k − na +1)
u(k −1)… u(k −nb +1)]T
dim x =n +n −1 a
b
Note that the state vector at time k is simply formed using past values of the input and output variables. No state observer is required. In contrast, if minimal state space realizations are used, then a state observer is usually required.
Dr. V.M. Becerra
7
CY4A2 Advanced System Identification
L−a M1 M M M A = M 0 M0 M M MN 0
1
−a
2
Lecture 5
−a
b
na
2
0
0
0
1
0
0
0
0
0
0
0
0
1
1
C = 1 0 0 0 0
Dr. V.M. Becerra
nb
0
Lb O M0P M P MP M P B = M 0 P M1 P MP M P MN 0 PQ n ×1
8
1×n
O P 0P P P 0P 0P P P 0P Qn ×n
b
CY4A2 Advanced System Identification
Lecture 5
The self tuning controller
Design parameters Q, R
LQ tracking optimal controller design
Self-tuning regulator
a ... a 1 na b ... b 1 nb
RLS estimator
Controller Parameters K, K r , x Command signal uc
Control signal u
u = − K f x + K r uc
Output y
Process
Recall the RLS algorithm: T
K ( k) = P( k−1) ( k) I + ( k) P( k−1) ( k)
−1
(k)= y(k)− (k)T ( k −1) (k) = (k −1) + K ( k)
P( k) = I − K( k) ( k)
T
(k ) −1
P( k−1)
Note: this type of controller may be thought of as an infinite horizon adaptive predictive controller . This type of controller, with minor modifications, is well suited for multivariable systems.
Dr. V.M. Becerra
9
CY4A2 Advanced System Identification
Lecture 5
Example 5.1 Consider the plant:
05 . G(s) 2 s s 1
The z- transform equivalent of this plant under zero order hold is:
000935 . z + 0.00875 G( z ) 2 . . z −17826 z 08187
The plant is to be controlled by a self-tuning LQ controller, using the least squares parameter estimation algorithm.
Dr. V.M. Becerra
10
CY4A2 Advanced System Identification
Lecture 5
RLS model:
The RLS model has the following ARX structure:
y( k)=− a y( k−1)− a y( k− 2)+ b u( k−1)+ b u( k− 2)+ ( k) 1
2
1
2
The parameter and regression vectors are
=[ a1 a2 b1 b2 ]T
( k) =[ − y( k −1) − y(k − 2) u( k −1) u( k − 2)]T
The forgetting factor used was 0.98, the sampling time was 0.2 s, the initial parameter vector was . . . . ]T and the initial covariance matrix =[ 01010101 was P =100 × I . 4
Dr. V.M. Becerra
11
CY4A2 Advanced System Identification
Lecture 5
The non-minimal state space realization used was given by:
x(k) = y(k)
L−a M A = 1 M MN 0
y(k −1) u(k −1)
−a
1
2
O P 0 P 0 PQ
b
0 0
2
Lb O M P B = 0 M P MN 1 PQ
T
1
C = 1 0 0
Controller :
The control law was:
u( k) = −
f
x(k) + K ruc
The following tuning parameters were used: Q = 1.0, R = 0.03
The command signal uc was a square wave with amplitude [+1, -1] and period 50 s. A small random signal was added to the controller output in order to enhance input excitation, which is important for identification.
Dr. V.M. Becerra
12
CY4A2 Advanced System Identification
Lecture 5
Simulink diagram, Example 5.1 Mux Mux y and uc SQUARE WAVE uc
u[n]
Noise LQ Controller
+ + Sum
Controller
x(k)
0.00935z+0.00875 z2−1.7826z+0.8187 Plant
State Generator phi
Regression vector Generator
RLS Estimator KfKr lqsfun To Workspace3LQ control design
Recursive least squares Parameter Estimator
theta To Workspace2
Dr. V.M. Becerra
y[n]
t Clock To Workspace
13
y To Workspace1
CY4A2 Advanced System Identification
Lecture 5
Simulation Results, Example 5.1
1 c u d n a y
0
−1 0
50
100
150
50
100
150
50
100
150
1 a t e h t
0
−1 −2 0
s n i a g r e l l o r t n o c
20
0
−20 0
time (s)
Notice that the controller does not have integral action, since the steady state error is non-zero.
Dr. V.M. Becerra
14
CY4A2 Advanced System Identification
Lecture 5
Integral Action
There are several ways of introducing integral action to a controller, and so eliminate steady state error. A simple way of doing it is to add a term proportional to the accumulated error to the controller output, so that the new controller output is given by:
u( k)=− K x(k)+ K u(k)+ K d( k) f
r
i
where K f and K r are obtained using the LQ design procedure, K i is a constant chosen by the designer and d (k ) is given by the recursive formula:
d( k)=d(k −1)+ (u (k)− y(k)) c
Care must be taken to stop updating d (k ) when the controller or associated actuator saturate at their higher or lower limits. Otherwise an undesirable phenomenon called integrator windup may occur. Note that is is also possible to compute K i optimally by using a model of the system with an extra state, where the extra state is d (k ).
Dr. V.M. Becerra
15
CY4A2 Advanced System Identification
Lecture 5
Example 4.2 This example is identical to Example 6.1, except that the control law has been modified to:
u( k)=− K x(k)+ K u(k)+ K d( k) f
r
i
d( k)=d(k −1)+ (u (k)− y(k)) c
where K i = 0.1. This introduces integral action into the controller. 2 c u d n a y
0
−2 0
50
100
150
50
100
150
100
150
1 a t e h t
0
−1 −2 0
s n i a g r e l l o r t n o c
20
0
−20 0
50 time (s)
Dr. V.M. Becerra
16