CHAPTER 3
CONTROLLER DESIGN
3.1
PID Controller
Proportional Integral Derivative (PID) is an old control algorithm that is still used until
now [38]. PID controller was first placed on the market in 1939. A survey in 1989 in Japan,
showed more than 90% of controllers used in industry is PID [39]. PID algorithm is widely
used because of its simplicity and easy to implement [40]. According to A. Balestrino,
et.al.[41], three main reasons that PID is widely used are:
a) Reduction number of parameters
b) Well established tuning rules
c) Good Performances
PID consists of three controller part that is proportional, integral, and derivative, Fig.
3-1 shows PID structure and its formula is stated in (3-1). PID performances depend on its
gain values, namely proportional gain (KP), integral gain (KI), and derivative gain (KD).
Therefore, finding the PID gain values, known as PID tuning, is important when using this
controller. Each PID part has different function as follows [15]:
1) Proportional
This part increases the response speed and control accuracy of the system. Bigger
KP can lead to faster response, if it is too big, the overshoot will be large and the
system will tend to instable. If KP is too small, the steady state error is larger.
2) Integration
This part used to eliminate the steady state error. Bigger K I will eliminate steady
state error faster. However, if K I is too big, there will be integral saturation at the
beginning of the control process and overshoot will be large. On the other hand, if K I
is too small, the steady state error will be very difficult to be eliminated and control
accuracy will be bad.
3) Differentiation
This part improves the dynamic performance of the system. It can inhibit and
predict the change of error. However, if KD is too big, the response process will brake
early and the regulating time will be long.
21
( )=
Fig. 3-1 PID Structure
( )+
0
( )+
( )
(3-1)
There are some PID tuning methods. According to Bansal [38], there exist two
categories: classical method and computational method. Classical method gives the faster
computation time and is easy to be applied. However, PID from classical tuning can not work
well at non-linear plant, high order system, and also not too adaptable to the disturbance [40].
Examples of classical tuning method are Ziegler – Nichols and Cohen-Coon method. On the
other hand, PID computational method use artificial intelligent such as Fuzzy and Neural
Network to find PID gain values. This method is usually done by online so that PID gain
value changes according to the system conditions. This ability makes PID controller more
adaptive [15].
3.2
Neural Network
Neural Network (NN) or known as Artificial Neural Network (ANN) is the most
generic form of Artificial Intelligent (AI) for emulating the human thinking process. It
originated from modeling the brain, demonstrates the ability to learn, recall and generalize
from training patterns. It is composed of a large number of highly interconnected neurons to
solve the problem. ANN first proposed by McCulloch and Pitts in 1943 which perform simple
threshold logic computations [20]. This technology is now advancing rapidly and gives a
significant impact to our society.
Individual nodes in a neural network emulate biological neurons by taking input data
and performing simple operations on the data and passing the result to the other neurons. Fig.
3-2 shows the schematic comparison between biological neuron and artificial neuron. Input
path as dendrites which is the input way to the cell body, activation function as nucleus which
22
perform processing, and output path as axon to transfer the result to the other neurons. In the
neural network, the network between the neuron connected by weighting value.
Fig. 3-2 Schematic Comparison between Biological Neuron and Artificial Neuron [42]
Neural network classified the neuron in some layer depend on its characteristics. Main
factor determined the neuron’s character is its activation function and the pattern of weighting
value. At the same layer, neuron will have the same activation function. There are three kinds
of layer that are input layer, hidden layer, and output layer as shown in Fig. 3-3. Input layer
receive the information from the environment and then transfer the information to the hidden
layer through weighting value. Hidden layer, placed between input and output layers, since
neural network just have one input layer and one output layer hence the complex network in
composed of multiple hidden layers. It also possible to eliminates the hidden layer, called as
single layer network [43]. Output layer used to put out the result from neural network.
Fig. 3-3 Neural Network Layer
23
3.2.1
Activation Function
There are many kinds of activation functions in neural network, and some of them are:
1) Linear
This function will have the value of 1 if the input is greater or equal to 1, and -1
if the input lower or equal to -1. The output is the same with input value when the
input is between 1 and -1.
,
=
1,
1 ,
1<
1
<1
1
(3-2)
Fig. 3-4 Linear Function Curve
2) Threshold
This function will give output 1 if the input is greater than threshold value, , and
output 0 if the input is lower than the threshold.
=
0 ,
1 ,
3) Signum
<
>
(3-3)
Fig. 3-5 Threshold Function Curve
24
This function will have the output 1 if the input is greater than 0, -1 if the input
lower than 0, and 0 if the input is zero.
=
1 ,
0 ,
1 ,
4) Sigmoid
>0
=0
<0
(3-4)
Fig. 3-6 Signum Function Curve
This function will give the output between -1 and 1, formulated as
=
3.2.2
(3-5)
+
Fig. 3-7 Sigmoid Function Curve
Back Propagation Learning
Since neural network works as human brain, it can learn information or knowledge.
Neural network learning results in changes of weighting values. One of the learning methods
is Back Propagation (BP). Back propagation Neural Network (BPNN) is the most popular
neural network for practical applications. It uses back propagation learning algorithm which
can be divided into two phase: data feed-forward and error back propagation [15].
25
For data feed-forward, the information input is fed into the input layer followed by
hidden layer and output layer. Finally, the output of BPNN is obtained from the output layer.
In the error back propagation phase, the actual output value of the network is obtained and
then compared with desired value. The error between them is propagated backward. The
connection weights between neurons are adjusted by learning method such as gradient descent
algorithm. Fig. 3-8 illustrates back propagation learning process. Solid line arrow illustrates
feed-forward phase and dashes line arrow for error back propagation phases. X is the input
layer, Y is the hidden layer, and Z is the output layer, while wy,x is the weight value between
input layer and hidden layer, and wz,y is the weight value of the hidden layer and the output
layer. I1 and I2 are data input and O is data output.
•
Feed-forward phase
Fig. 3-8 Back Propagation Learning
1) Input layer. In this layer, data is inputted to the NN system, the output of this layer is
same with its input.
1 = 1(
)
2 = 2(
)
(3-6)
2) Hidden layer. Neuron in hidden layer, get the data from input layer through weighting
value. After summing some input signal from previous/ input layer neuron, the
activation function is used to get the output.
( )=
=1
( )= (
26
,
( )) ,
(3-7)
where Yin is the input of neuron Y, n is the number of neuron in input layer, Yout is
the output of neuron Y, and f(.) is the activation function.
3) Output layer. All the data input from previous neuron (hidden layer) through
weighting values are summed and then activation function is used to get the output.
( )=
=1
( )= (
,
( ))
(3-8)
where Zin is the input of neuron Z, m is the number of neuron in hidden layer, and
Zout is the output of neuron Z.
•
Backpropagation phase
4) Calculate the error between NN output and target data. Then, find the error
information and weighting value correction.
( )= ( )
( )=
( )=
( )
The new weighting value for
learning rate and
5) Calculate
the
(
is
( )
( )+
is the inertia coefficient.
weighting
value
( )=
( )=
( ))
( )=
between
(
( )
( )=
(
1)
1) +
hidden
( ))
(
(
layer
(3-9)
( ), where
and
input
is
layer.
3
=1
( )+
1) +
(
( )
1)
(3-10)
Step 1 to 5 is repeated until the stopping criteria is met. Usually the stopping criteria
are based on the value of minimum error and/ or the number of iterations.
3.3
Back Propagation Neural Network (BPNN) based PID
PID control plays an important role in a control system because of its simplicity and
reasonably good performance. However, it is difficult to tune PID to get the right gain and
also its performance might decrease as system condition changes [44]. Since BPNN is an
27
adaptive learning algorithm, it can be used to determine PID gain and make it adaptive with
on-line learning. This combination is called NN-based PID because the learning algorithm
that used is back propagation it also called as BPNN-based PID.
According to [15], the advantages of NN are the ability to learn and fault tolerance.
NN-based PID has been applied in some control cases with good performances in term of
reference tracking. Gu and Wang [16] used NN-based PID in electro-thermal boiler control to
control the boiler’s thermal. Jing et al [17] used NN-based PID for speed control of an
induction motor, Yang et al [18] used it for AC servo drive system, and Shoujun and Weiguo
used it for speed tracking of BLDC Motor [15]. All of the authors have the same conclusion
that NN-based PID can improve system performance.
The discrete algorithm of traditional PID is shown in (3-11) where e, KP, KI and KD
are error, proportional gain, integrator gain and differential gain, respectively.
( )= (
1) +
[ ( )
(
1)] +
( )+
[ ( )
2 (
1) + (
2)]
(3-11)
BPNN-based PID controller structure is shown in Fig. 3-9 (a). The main objective of
this control is to track speed reference signal, with acceleration and jerk restriction which are
± 1 m/s2 and ± 1 m/s3, respectively, according to TRTS regulation. A small value of
acceleration and jerk is needed for passenger convenience and to avoid slip between the wheel
and rail. The input of BPNN are speed ref (r), speed response (y), and error (e), while the
output is PID gain values namely KP, KI, and KD as shown in Fig. 3-9 (b).
(a)
28
(b)
Fig. 3-9 (a) BPNN-PID Controller Structure, (b) BPNN Structure
Back propagation learning in BPNN-based PID can be explained as follow [16]:
1) Input layer
In general, the input and output of the input layer are
(1)
1 =
(1)
2 =
( ),
(1)
3 =
( ),
( )
(3-12)
Superscript (1), (2), (3) means input layer, hidden layer, and output layer, respectively.
2) Hidden layer
Inputs and outputs of the hidden layer are expressed as:
(2)
where
(2)
(2)
( )=
( )=
(2)
=0
(2)
(1)
( ) , = 1,2, … ,
(3-13)
is the weight value between input and hidden layers, and (. ) is a sigmoid
function, namely ( ) =
hidden layer, respectively.
+
, and M, N are the number of neuron in input layer and
3) Output layer
Inputs and outputs of the output layer are
29
(3)
(3)
where
(3)
(3)
( )=
(3)
1 (
( )=
)=
,
( )=
+
(3)
=0
(2)
( ) , = 1,2, … ,
(3)
2 (
)=
(3)
3 (
,
)=
(3-14)
is the weight value between hidden and output layers, and (. ) is a positive
sigmoid function such as
. We chose positive sigmoid function in the
output to keep KP, K I, and KD to have positive value. P is the number of neuron in
output layer.
We want to minimize the performance index (3-15) with gradient descent method and use
correction formula of weight as (3-16) where
is the learning rate and
is the inertia
coefficient.
1
( )= ( ( )
2
( )
( )=
( ))2
( )
+
( )
.
(3-15)
(
1)
(3-16)
can be expressed as
( )
(3)
and
( )
=
( )
( )
( )
.
( )
(3)
(3)
Because
( )
( )
is unknown,
.
( )
( )
( )
(3)
(2)
=
( )
( )
(3)
( )
(3)
( )
(3)
.
(3)
( )
( )
( )
(3-17)
(3-18)
(sgn means signum function) is used. This may cause
imprecise calculations, it fixed by adjusting the learning rate. According to (3-11) and (3-15)
we get:
( )
(3)
1 (
)
= ( )
( )
(3)
2 (
)
(
= ( )
30
1)
( )
(3)
3 (
)
= ( )
2 (
1) + (
(2)
(3)
2)
(3-19)
Therefore the learning algorithm of the weighting value between output and hidden layers as
(3)
(3)
(3)
( )=
= ( )
= 1,2,3, … . .,
( )
( )
+
( )
(3)
(
1)
(3)
(
( )
( ))
(. ) = ( )(1
( ))
(1)
1)
(3-20)
And the learning algorithm of the weighting value between hidden and input layers is
(2)
(2)
Where the initial value of
(2)
( )=
=
(
(2)
( ))
= 1,2,3, … . . ,
(2)
and
(3)
(2)
+
3
=1
(3)
(. ) = (1
(
(3)
( )
are chosen randomly.
31
( )2 )/2
(3-21)