Professional Documents
Culture Documents
Networks
Daniel Wu Fakhreddine Karray Insop Song
Dept. of Systems Design Eng. Dept. of Electrical & Computer Eng. Dept. of Systems Design Eng.
University of Waterloo University of Waterloo University of Waterloo
Waterloo, ON N2L 3G1 Waterloo, ON N2L 3G1 Waterloo, ON N2L 3G1
Model Reference Adaptive Neural Network Control based on the Pump Servor
Motor
backpropagation algorithm is applied on training the system. Valve3 Valve1
Both control algorithms are developed to embed into a stand-
alone DSP-based micro-controller and their performances are
compared.
DSP Controller
I. I NTRODUCTION
Traditionally, accurate mathematical model-based strategies Fig. 1. Configuration of the Water Level Control System. The system consists
of the servo motor, valves, a pump, a infra-red sensor and a DSP controller.
have been applied to deal with control problems. However,
water level control system, for example, is very complex
system, because of the nonlinearities and uncertainties of a non-crystalloid [5].
system. Conventional control approaches are not convenient In this paper, we first elaborate the configuration of the
to solve the complexities. Fuzzy logic and neural networks water level control system. Then, we introduce Sugeno fuzzy
control have emerged over the years and become one of the control [7], [8] and model reference adaptive neural network
most active and fruitful areas of the research in the intelligent control (MRANNC) [6], [9], [10] strategies based on back-
control applications. There are two major different types of propagation algorithm. Finally, some experimental and real-
the control rules in fuzzy control: the Mamdani type and the time results using DSP controller are presented.
Sugeno type. The Mamdani control rules are significantly more
linguistically intuitive while Sugeno rules appear to have more II. S YSTEM C ONFIGURATION
interpolation power even for a relative small number of control Figure 1 shows the system configuration. The system con-
rules. In neural network control, the most commonly used sists of the servo motor, valves, a pump, a infra-red sensor and
ones are supervised control, direct inverse control and neural a DSP controller. Water is constantly pumped into a vertical
adaptive control. tube by a pump. Water can outflow from the horizontal tube.
There are many papers addressed the fuzzy or neural The general control objective is to reach and stabilize a certain
networks control in the water or liquid level control system. water level in the vertical tube. As shown in the figure, a
Niimura et al. utilized the fuzzy logic for water level control in sensor measures the water level and sends height signal to
small hydro-generating units[1]. Roubos et al. chose Sugeno the DSP micro-controller. The controller controls the servo
fuzzy model as the model structure for a linear model based motor, which adjusts the valve 1 to maintain a desired water
predictive control of the liquid level [2]. Ghwanmeh et al. level in the vertical tube. Valve 2 constantly opens and valve 3
showed a self-learning fuzzy logic control applied to a non- randomly opens to provide disturbances to the control system.
linear process and demonstrated the robust and repeatable
performance [3]. Naman et al. presented an adaptive model-
reference fuzzy controller for controlling the water level in a III. F UZZY L OGIC C ONTROL
water tank [4]. Xiao et al. provided a backpropagation neural In Fuzzy control, two inputs for the system are chosen.
network algorithm used to adjust the parameters of the PID They are an error (e) and an error derivative (ė). The error
controller and control the liquid level of molten steel smelling is calculated by taking the difference between the reference
1 If e is HN OPEN valve WIDE
2 If e is N and ė is NOT P OPEN valve A BIT HN N S P HP
3 If e is N and ė is P LEAVE valve ALONE
4 If e is S and ė is N OPEN valve A BIT
5 If e is S and ė is S LEAVE valve ALONE
6 If e is S and ė is P CLOSE valve A BIT
7 If e is P and ė is N LEAVE valve ALONE -15 -5 -2 0 2 5 15
8 If e is P and ė is NOT N CLOSE valve A BIT
9 If e is HP CLOSE valve A LOT (a) Error Membership Functions
TABLE I
RULE BASE N S P
Output Functions
1 OPEN valve WIDE 900 · e + 0 · ė − 20 -4 -0.5 0 0.5 4
2 OPEN valve A BIT −50 · e − 200 · ė − 20
3 LEAVE valve ALONE −5 · e + 0 · ė + 0 (b) Error-Dot Membership Functions
4 CLOSE valve A BIT −50 · e − 2000 · ė + 20
5 CLOSE valve A LOT −100 · e + 0 · ė + 20
error
TABLE II
O UTPUT F UNCTIONS . HN N S P HP
N 1 2 2 3 5
error_dot
S 1 2 3 4 5
P 1 3 4 4 5
signal and the current water height. The error derivative is
calculated by subtracting a previous error from the current (c) Mapping
error. The output of the system is a voltage that is sent to a
servo motor to control the valve 1.
Fig. 2. Membership Functions and Mapping
The Sugeno model is used in the system. The Sugeno model
is computationally efficient, and works well with optimization
and adaptive techniques, so it is popular for control problems, ei -
in particular for dynamic nonlinear systems. The Sugeno fuzzy NN yi ec
identifier
model takes the form: - +
ec TDL TDL ei
IF e is A AND ė is B, THEN SERVO is f (e, ė) +
r (t ) TDL yp
NN u Nonlinear
controller
The output function f (e, ė) takes the form: Plant
TDL TDL
A2 e + A1 ė + A0
δk = Tk − Nki (1) To illustrate the derivation of the error signals for the neural
network controller, Figure 4 provides the connections between
where Tk is the target pattern and Nki is the actual output of the controller and identifier networks.
the identifier, and between the hidden and input layers, it is The adaptation of the weights of the neural network con-
expressed as X troller between the hidden and output layers can be derived as
′
δj = f (netj ) δk · wkj (2) follows:
k c ∂E i
∆wkj =η· c (6)
′
Here, f (netj ) is the derivative of the activation function ∂wkj
f (netj ) where where
1
f (netj ) = (3) 1
1 + exp(−netj ) Ei =
· (yp − r)2 (7)
2
The weights between the input and hidden layers are updated where yp and r are the actual and desired plant output. The
as superscript c denotes the variables belonging to the neural
∆wji (t + 1) = η · δj · Nii + α · ∆wji (t) (4) network controller and superscript i denotes the variables
and the weights between the hidden and output layer are belonging to the neural network identifier.
updated as Using chain rule, equation (6) can be expanded as follows:
3.5
TABLE III
3
PARAMETERS S ETUP
Voltage (V)
2.5
1.5
and 0.5
∂netij i
0
∂Nii
so,
Fig. 5. Plant Disturbance Training Data, U is an input signal and Y is a
δkc = δji · wji
i
(11) output of the sensor
The error signal between the input and hidden layer of the Plant Test Data Y
∂E i
∂E i ∂Njc 4
2.5
Voltage (V)
By using chain rule 2
1.5
∂E i X ∂E i ∂netc 1
k
c = ·
∂Nj ∂netck ∂Njc 0.5
0
1 401 801 1201 1601 2001 2401 2801 3201 3601 4001 4401 4801 5201 5601
-0.5
and Sample
∂Njc ′
= f (netcj )
∂netcj Fig. 6. Plant Test Data
where
′
f (netcj ) = Njc · (1 − Njc ) 2) Identifier Training and Testing: The trained identifier
will be used as a representation of the system plant to
so, effectively create a controller for the system. Then, the off-
X line training of the controller will be feasible to reach.
δjc = Njc · (1 − Njc ) · ( δkc · wkj
c
) (13) 1. Training Data
An open loop system was used to obtain a system response
The weights of the neural network identifier can be further curve for the plant response to a random input signal. Figure
improved online if necessary. This can be reached by back- 5 shows the input signal used for training of the NN iden-
propagation of the following error equation through the neural tifier. This was done by sending a voltage signal through a
network identifier at every sample. yp and yi are the outputs potentiometer into the servo motor, and it controls the valve
of the actual plant and neural network identifier, respectively. 1. By creating a random input control signal and measuring
the sensor output while a random and a constant disturbance
1
e= · (yp − yi )2 (14) exists. A set of data was created and indicated the behavior
2 of the plant response to a characteristic input signal. It was
V. E XPERIMENTAL R ESULTS designed to fall within the operating range of the sensor. As
shown in the figure, the input signal u varies between values
The neural network control algorithm were first trained and
of 2V and 4V .
tested with C language with a normal PC. Then, the algorithm
2. Testing Data
were ported to DSP-based controller and tested. Once the training portion of the Identifier is completed, it
needs to be verified with the training results. A selection of
A. Training and Testing for Neural Network Control
similar data was created for testing the trained network. Figure
1) Parameters Setup: In order to have quicker calculation 6 shows a set of testing data used for the Identifier.
without sacrificing performance, some parameters were setup 3. Identifier Training
as shown in Table III. In Table III, ni ,nj and nk denote Identifier training resulted to a level of error of 7.9842
the number of nodes in the input layer, hidden layer and after 150,000 epochs. At the cut-off of 150,000 epochs, the
output layer, respectively, η and α denote learning rate and identifier was still converging on an error, but extremely
momentum term, respectively. slowly. Then, this level of an error was used to move onto
Identifier Training Error Controller Training Data
Error Desired
1000 35
30
25
100
15
10
10
1 0
100 1000 10000 100000 1000000 1 101 201 301 401 501 601 701 801 901 1001 1101 1201 1301
Epoch Test Sample
35
4
30
3.5
2.5 20
Voltage (V)
2 15
1.5 10
1 5
0.5 0
1 26 51 76 101 126 151 176 201 226 251 276 301 326 351 376
0 Sample
1 501 1001 1501 2001 2501 3001 3501 4001 4501 5001 5501
-0.5
Epoch
values were held within the ideal operating range for which
10
Figure 10 shows a set of testing data used for the neural 0 1000 2000 3000 4000 5000 6000 7000 8000
Epoch
network controller. As can be seen, this pattern is somewhat
similar to that seen in the training. As was the case in
the identifier, once the training portion of the controller is Fig. 11. Controller Training Error
Neural Network Control Results
Controller Test Data Setpoint
R Sensor1
30
Y
1.4
25
1.2
1 20
0.6
10
0.4
5
0.2
0
0
17
25
33
41
49
57
65
73
81
89
97
105
113
121
129
137
145
153
161
169
177
185
193
201
209
217
1 26 51 76 101 126 151 176 201 226 251 276 301 326 351 376
Time (s)
Sample
Fig. 12. Controller Testing Fig. 14. Online Neural Network Control Result
FLC NNC
20
Plant Math Model Unnecessary Unnecessary
Water Level
15
Computation Light Heavy
Tracking Performance Good Better
10 Disturbance Rejection Good Better
5
TABLE IV
C OMPARISON BETWEEN THE FUZZY CONTROL AND NEURAL NETWORK
0
CONTROL BASED ON THE EXPERIMENTAL RESULTS
1
11
21
31
41
51
61
71
81
91
101
111
121
131
141
151
161
171
181
191
201
211
221
231
Time (s)