# Adaptive PID Controller Using RLS for SISO Stable and Unstable Systems

Authors: Rania A. Fahmy; Ragia I. Badr; Farouk A. Rahman
Journal: Advances in Power Electronics
 (2014)

---

## Abstract

The proportional-integral-derivative (PID) is still the most common controller and stabilizer used in industry due to its simplicity and ease of implementation. In most of the real applications, the controlled system has parameters which slowly vary or are uncertain. Thus, PID gains must be adapted to cope with such changes. In this paper, adaptive PID (APID) controller is proposed using the recursive least square (RLS) algorithm. RLS algorithm is used to update the PID gains in real time (as system operates) to force the actual system to behave like a desired reference model. Computer simulations are given to demonstrate the effectiveness of the proposed APID controller on SISO stable and unstable systems considering the presence of changes in the systems parameters.


---

## Body

## 1. Introduction

A challenging problem in designing a PID controller is to find its appropriate gain values (i.e., proportional gainK
P, integral gain K
I, and derivative gain K
D) [1]. Moreover, in case where some of the system parameters or operating conditions are uncertain, unknown, or varying during operation, a conventional PID controller would not change its gains to cope with the system changes. Therefore a tuning method is needed. Various PID controller tuning techniques have been reported in the literature. It is classified into two groups, offline tuning methods as Zeigler-Nichols method and online tuning methods or adaptive PID. APID can tune the PID gains to force the system to follow a desired performance even with the existence of some changes in system characteristics [2].Adaptive control has been commonly used during the past decades specially the model reference adaptive control (MRAC). Its objective is to adapt the parameters of the control system to force the actual process to behave like some given ideal model which is demonstrated in [3, 4]. There are two main categories of adaptive control. (
1
)
Indirect. It starts with controlled system identification and then uses those estimated parameters to design the controller as presented in [5–7]. (
2
)
Direct. This is more practical than indirect method. It uses a parameter estimation method to get the controller parameters directly the same as introduced in [8, 9].An adaptive PID controller is presented in [10] using least square method which is an offline parameter estimation method. On the other hand, an optimal self-tuning PID controller is introduced in [5] using RLS to estimate the model from its dynamic data. RLS is a recursive algorithm for online parameter estimation that is frequently used because it has a fast rate of convergence. In [11] an online type of controller parameter tuning method is presented by utilizing RLS algorithm. It develops the standard offline fictitious reference iterative tuning FRIT method to be used as a modified estimation error for RLS algorithm. Also the controllers in [11–13] present online tuning based on input and output data of the system.In the case of unstable systems, few researchers study the behaviour of the adaptive PID techniques on unstable systems and examine its ability to stabilize them as verified in [14–17].In this paper, the direct method of adaptive control is considered. RLS algorithm is used as adaptation mechanism to tune the PID gains automatically online to force the actual process to behave like the reference model. The proposed approach has also the ability to stabilize the unstable system. Adding some parameters variations in actual process during its operation time confirms the proposed controller adaptation capability and robustness against process variation in both stable and unstable cases.The structure of this paper is as follows. In Section2, the problem statement is presented. In Section 3, an APID controller and its adaptation mechanism using RLS are introduced. The proposed technique is applied to numerical examples in Section 4 and its results show its ability in tracking the reference input signal using APID controller for both stable and unstable systems even when the considered system suffers from changes of its parameters. Finally, in Section 5, the conclusion and some suggestions for further work are presented.


## 2. Problem Formulation

Consider a system shown in Figure1, where G is a process that is modeled as a single-input and single-output linear system, C
(
θ
) is a PID controller, and θ denotes a parameter vector to be tuned in the controller. Also, u, y, r, and e
=
r
-
y denote the control input, output, reference signal, and error signal, respectively.Figure 1
Closed-loop system.In conventional control, the PID controller can be expressed as(1)
u
(
t
)
=
K
P
e
(
t
)
+
K
I
∫
0
t
e
(
t
)
d
t
+
K
D
d
e
(
t
)
d
t
.Note that, approximately, the transfer function of integratord
/
d
t can be expressed as s
/
(
τ
s
+
1
).Simply, the controller transfer function [11] can be expressed as
(2)
C
(
s
)
=
[
K
P
K
I
K
D
]
[
1
1
s
s
τ
s
+
1
]
.Define(3)
θ
T
=
[
K
P
K
I
K
D
]
,
ϕ
1
=
[
1
1
s
s
τ
s
+
1
]
.So (2) can be rewritten in the form
(4)
C
(
s
)
=
θ
T
ϕ
1
.In most of practical applications, the actual structure of the controlled system is unknown or varying. Therefore, the adaptive mechanism is used for self-adjustment of the PID gains to achieve the best tracking performance. The proposed technique controls the motion of both stable and unstable systems to follow the ideal trajectory provided by a designer defined reference modelM
(
s
).


## 3. APID Controller Using RLS

The proposed controller objective is to find the coressponding controller parameters (PID gains) using RLS algorithum as adaptation mechanism such that the closed-loop transfer function is more or less equal to the reference model transfer function. In other words, the reference outputy
m
(
t
) tends to be equal to the plant output y
(
t
) as follows:
(5)
y
m
≡
y
.So it can be written as(6)
M
(
s
)
r
(
t
)
≡
y
(
t
)
,
where M
(
s
) is a given model reference transfer function which represents the ideal closed-loop dynamics.Hence, (6) can be written as
(7)
M
(
s
)
r
(
t
)
≡
r
(
t
)
-
e
(
t
)
.Applying the controller transfer functionC
(
s
) to both sides of the above equation results in
(8)
C
(
s
)
M
(
s
)
r
(
t
)
≡
C
(
s
)
[
r
(
t
)
-
e
(
t
)
]
,
and becomes
(9)
C
(
s
)
(
1
-
M
(
s
)
)
r
(
t
)
≡
u
(
t
)
.Now the modified estimation error of RLS can be defined as(10)
ζ
=
u
(
t
)
-
C
(
s
)
(
1
-
M
(
s
)
)
r
(
t
)
.This means that(11)
ζ
=
u
(
t
)
-
θ
T
ϕ
1
(
1
-
M
(
s
)
)
r
(
t
)
.Based on the RLS algorithms, we tune the parametersθ which are the PID gain values so that the following performance index is minimized:
(12)
J
=
∑
k
=
0
N
ζ
2
(
k
)
.On the other hand, in order to apply the classical equations of the RLS estimation algorithm used to find the parametersθ, a modified estimation error can be expressed as
(13)
ζ
=
u
-
θ
T
ϕ
,
where ϕ
=
ϕ
1
(
1
-
M
(
s
)
)
r
(
t
).To build the RLS algorithm using the 2nd-Level S-Function in Matlab, the first term in right hand side of (13) has to be rewritten as
(14)
ζ
=
u
-
ϕ
RLS
T
θ
,
where ϕ
RLS
T
=
[
ϕ
T
0
0
ϕ
T
] and θ is a vector which contains all parameters of PID gains.RLS is an algorithm which recursively finds the optimal estimateθ
^
(
k
) of the controller parameter by using θ
^
(
k
-
1
) [3]. Thus, considering (14), the proposed RLS update laws will be as follows: (15a)
θ
^
(
k
)
=
θ
^
(
k
-
1
)
+
K
(
k
)
[
u
(
k
)
-
ϕ
RLS
T
(
k
)
θ
^
(
k
-
1
)
]
,
(15b)
K
(
k
)
=
p
(
k
-
1
)
ϕ
RLS
(
k
)
×
[
I
+
ϕ
RLS
T
(
k
)
p
(
k
-
1
)
ϕ
RLS
(
k
)
]
-
1
,
(15c)
p
(
k
)
=
p
(
k
-
1
)
-
K
(
k
)
ϕ
RLS
T
(
k
)
p
(
k
-
1
)
,where K is the adaptation gain and P is the covariance matrix.According to the above RLS algorithm equations, the controller parametersθ
^
(
k
) are updated at each time. Thus, variation of the controller parameters θ
^
(
k
) may be large at the start of algorithm, at the time when plant characteristics change rapidly, and at the time when the set-point reference is changed. Due to this, the system may stop working steadily.In order to avoid such a problem and reduce the variation of the controller parametersθ
^
(
k
) is filtered by a low-pass filter which can be defined as
(16)
H
LPF
=
α
z
+
α
-
1
,
0
≤
α
≤
1
,
where α is a sufficiently small positive constant. So θ is changed reasonably.


## 4. Numerical Examples

In order to illustrate the main features of the proposed APID using RLS, simulation examples are now presented. The following examples cover stable and unstable systems cases and consider the changes in the system parameters during simulation time.


### 4.1. Stable SISO System

Consider the plant used in [11]
(17)
G
(
s
)
=
12
s
+
8
20
s
4
+
113
s
3
+
147
s
2
+
62
s
+
8
.Let the sampling time beT
s
=
0.001 and let the reference model be
(18)
M
(
s
)
=
1
(
0.5
s
+
1
)
2
.The reference input signal is chosen to be a delayed square wave.The proposed technique in Section3 is applied. The initial controller parameters and the initial correlation matrix are set to be θ
^
(
0
)
=
[
3
0
1
] and P
(
0
)
=
1
0
4
I, respectively also consider α
=
1
0
-
4 and τ
=
0.1.In order to evaluate the proposed control method to plant uncertainties, we consider the case where there exists a change in one of the system poles at 155 s (i.e., the poles
=
1 changes to s
=
3); moreover the gain of the plant is doubled suddenly at 225 s.The output by the proposed APID using RLS controller is shown in Figure2 and it is compared with the controller presented in [11] and conventional PID. In the proposed controller the PID gains are tuned adaptively despite the variation of gain and poles of plant, and good tracking performance is maintained. It is clear from the figure that the proposed APID using RLS controller has superior performance as it has smaller overshoot at the beginning of the simulation than the controller in [11] and the conventional PID could not handle either the gain change or the pole change.Figure 2
Output in stable system case.


### 4.2. Unstable SISO System

Now, consider that the unstable system stated in [18] is a simple SISO model of inverted pendulum
(19)
G
(
s
)
=
1
s
2
-
1
.And reference model can be expressed as(20)
M
(
s
)
=
1
(
s
+
1
)
2
,
where natural frequency w
n
=
2 and damping ration ζ
=
1.The reference input signal is chosen to be a delayed square wave.The proposed technique in Section3 is applied and the initialization parameters are set to be θ
^
(
0
)
=
[
200
-
10
200
] and P
(
0
)
=
10
I, also consider τ
=
0.02.It is shown in Figure3 that the proposed APID using RLS controller can stabilize the system and achieve good tracking performance despite the fact that the gain of the plant is doubled suddenly at 155 s and the system’s unstable pole is changed at 255 s. On the contrary the conventional PID and the controller presented in [11] with the same initial parameters failed to stabilize the system.Figure 3
Output in unstable system case.


## 4.1. Stable SISO System

Consider the plant used in [11]
(17)
G
(
s
)
=
12
s
+
8
20
s
4
+
113
s
3
+
147
s
2
+
62
s
+
8
.Let the sampling time beT
s
=
0.001 and let the reference model be
(18)
M
(
s
)
=
1
(
0.5
s
+
1
)
2
.The reference input signal is chosen to be a delayed square wave.The proposed technique in Section3 is applied. The initial controller parameters and the initial correlation matrix are set to be θ
^
(
0
)
=
[
3
0
1
] and P
(
0
)
=
1
0
4
I, respectively also consider α
=
1
0
-
4 and τ
=
0.1.In order to evaluate the proposed control method to plant uncertainties, we consider the case where there exists a change in one of the system poles at 155 s (i.e., the poles
=
1 changes to s
=
3); moreover the gain of the plant is doubled suddenly at 225 s.The output by the proposed APID using RLS controller is shown in Figure2 and it is compared with the controller presented in [11] and conventional PID. In the proposed controller the PID gains are tuned adaptively despite the variation of gain and poles of plant, and good tracking performance is maintained. It is clear from the figure that the proposed APID using RLS controller has superior performance as it has smaller overshoot at the beginning of the simulation than the controller in [11] and the conventional PID could not handle either the gain change or the pole change.Figure 2
Output in stable system case.


## 4.2. Unstable SISO System

Now, consider that the unstable system stated in [18] is a simple SISO model of inverted pendulum
(19)
G
(
s
)
=
1
s
2
-
1
.And reference model can be expressed as(20)
M
(
s
)
=
1
(
s
+
1
)
2
,
where natural frequency w
n
=
2 and damping ration ζ
=
1.The reference input signal is chosen to be a delayed square wave.The proposed technique in Section3 is applied and the initialization parameters are set to be θ
^
(
0
)
=
[
200
-
10
200
] and P
(
0
)
=
10
I, also consider τ
=
0.02.It is shown in Figure3 that the proposed APID using RLS controller can stabilize the system and achieve good tracking performance despite the fact that the gain of the plant is doubled suddenly at 155 s and the system’s unstable pole is changed at 255 s. On the contrary the conventional PID and the controller presented in [11] with the same initial parameters failed to stabilize the system.Figure 3
Output in unstable system case.


## 5. Conclusions

In this paper, adaptive PID (APID) controller is proposed using RLS algorithm which updates the PID gains automatically online to force the actual system to behave like a desired reference model. Numerical examples have been shown to confirm the tracking capability of the proposed controller when it is applied to both stable and unstable systems. It also proves the efficiency of the controller during the changes of system parameters during operation of system. Moreover comparisons are made between the proposed APID and the adaptive controller presented in [11] and the conventional PID. This work can be further extended to drive the stability analysis for the proposed APID controller for SISO systems. Also, as a further research, the APID controller technique demonstrated in this paper can be modified to be applicable for MIMO systems and then its behavior can be investigated in the presence of some variations in system parameters.



---

*Source: 507142-2014-10-07.xml*