A
COURSE IN
NEURAL NETWORKS FOR
SYSTEM IDENTIFICATION AND CONTROL
___________________________________________________________________________
Goal:
These ex
erc
ises aim to give the student a fundamental ”feeling” for
how
neural
networks
work
. What are they? How are they trained? How can they be used for modelling of
nonlinear dynamic systems? How can they be used for control?
Material:
The book ”Neural Networks for Modelling and Control of Dynamic Sy
stems” by M.
Nørgaard, O. Ravn, N. K. Poulsen, and L. K. Hansen. Springer

Verlag, London
, 2000
.
Supplementary Literature
(for exercise 5)
:
”Nonlinear black

box modeling in system
identification: a unified overview” by Sjöberg et al., Automatica,
32(
12
), pp. 1691

1724,
1995.
Software:
MATLAB
, SIMULINK,
and the Neural Network Toolbox must be available.
The m

functions
’control.m
’,
’
initfile.m
’
,
‘dio.m
’,
’
d
ioph
a
n
t.m
’
,
‘siggener.m
’
,
‘
shift.m
’,
‘
progress.m
’
.
The data
set
’
actuator.mat
’.
Report:
The report should be written as a ”typical” research paper (2 columns, min. 10 pt. font).
One student: Write max.
5 pages.
Two students workin
g together: Write
max.
8 pages.
Work load:
5 E
C
TS
points.
___________________________________________________________________________
1. Introduction to MATLAB
If you are not familiar with MATLAB already, you must first learn how the package
wo
rks. Take a look in the manual or find one of the many tutorials available on the
internet.
2. Introduction to MLP Networks
Rea搠d桡灴敲‱渠 桥⁴數瑢潯欮
呲y⁴ e c歰牯瀠r
e浯猠楮⁍䅔LAB'猠se畲u氠le瑷潲t
呯潬扯T
2
3. Training of Neural Networks
I渠潲oe爠瑯t畮摥牳瑡湤nh潷o湥畲u氠湥瑷潲t猠a牥 t牡楮敤Ⱐy潵o獨潵s搠摥物癥 瑨攠扡ck

灲潰pga瑩潮oalg潲楴桭Ⱐ瑨攠䝡畳u

Ne睴潮walg潲o瑨tⰠa湤n瑨攠Le癥湢nrg

䵡牱畡牤琠
a汧潲楴桭 景爠a 湥瑷潲t 睩瑨w
tanh
units in the hidden layer and one
linear
unit in the
output
layer (see Section 2.4).
䝥湥ra瑥⁴桥潬汯睩 gxa浰me渠䵁呌䅂:
X = 2*pi*rand(1,300);
Y = sin(X) + 0.2*randn(1,length(X))
plot(X,Y,'+')
and train a network to approximate the underlying sine wave. Use a two

layer
network with 7
tanh
hidden unit
s and 1
linear
output unit. Compare the convergence
rate for the following three training algorithms: ordinary back

propagation, back

propagation with adaptive step size, and the Levenberg

Marquardt algorithm
. The
comparis
on is made
by plotti
ng the value of the criterion after
each
iteration.
Re畳u 瑨攠 摡瑡t gene牡te搠 a扯癥 a湤n c桯潳h 瑨攠 晡獴敳琠 潦o 瑨攠 瑥獴t搠 瑲t楮i湧
a汧潲楴桭献s呲a楮ia 湥瑷潲欠睩瑨w㈰2桩摤敮h畮楴猠a湤nc潭灡oe 瑨攠晩湡氠va汵攠潦o瑨t
c物瑥物潮r⡴桡琠楳Ⱐ睨w渠t桥 湥瑷潲t 桡猠bee渠瑲ti湥搠瑯t瑨攠浩湩n畭⤠睩w栠瑨攠癡
汵攠
潢瑡楮o搠d扯癥.
Introduce a set of test data generated exactly as the training data set:
X2 = 2*pi*rand(1,300);
Y2 = sin(X2) + 0.2*randn(1,length(X
2
))
plot(X
2
,Y
2
,'o
')
Write a small m

file that trains the network with 20 hidden units in the following
f
ashion:

Train 5 iterations
with
the
Levenberg

Marquardt
algorithm
.

Evaluate the criterion on the test set.

Train 5 iterations

etc, etc, etc
E
valuate the criterion
on training and test set, respectively
, and compare them
. R
un
a
lot of
iterations to be sure that the mini
mum is reached
. What happens?
呲a楮i瑨攠湥瑷潲t 瑯t瑨攠浩湩n畭u㜠瑩浥猬meac栠t業e 楮i瑩a汩z楮i 瑨攠睥i杨琠浡瑲楣i猠
摩晦e牥湴ny⸠C潭灡oe 瑨t 晩湡氠癡汵攠o映瑨攠c物瑥物潮o⡡湤n瑨攠睥ig桴h浡瑲ice猩⸠W桡琠
楳⁴桥潮o汵獩潮o⁴桩猠sx灥物浥湴?
4. Choice
of Network Architecture
啳U⁴桥
瑷漠摡ta 瑳 o洠扥m潲e
⸠呲a楮‱i 瑷t牫猠r楴栠h

楤摥渠畮楴献⁅癡汵慴l
each 潦o瑨t 湥瑷潲ts 潮ot桥 瑥獴t摡ta 獥琮tW桡琠楳it桥 潰瑩浡
氠湵浢敲 o映桩h摥渠畮楴s?
⡕獥⁷
桡琠y潵oa牮e搠db潶o⁷桥渠y潵潮摵c琠t桩猠h
x灥物浥湴℩.
3
5. Modelling of
Dynamic S
ystems
Load the file
‘
actuator
’
into the MATLAB workspace. This file contains the data
set for the hydraulic actuator that was used in Section 4.2
of the book
. The variable
“u” contains control inputs while the variable “p” conta
ins the observed outputs. Split
the data set into a training set consisting of the first 512 samples, and a test set
consisting of the remaining 512 samples. Try to estimate a linear ARX model as
described in the book. If the System Identification toolbox
for MATLAB is avilable
you can use this. Otherwise us
e a ”neural network” without
hidden units (only one
linear output).
Now train a neural network ARX model with 10 hidden
tanh
units and a linear output.
Train the network using
early stopping
.
This
means that the network is evaluated on
the test set after e
ach
iteration (after every 5 iterations will work too and is a little
faster)
. When the minimum test error has been
reached the training is stopped.
Compare the result with that obtained in the book. No
tice that the network should be
evaluated by
simulation
(this means that you will have to write some MATLAB code
to simulate the neural network model).
6. Control with Neural Networks 1
In this and in
the following exercise you will need the MATLAB script
control.m
and the
associated initialization file
initfile.m.
You are now going to design and implement a controller for the system:
which was used throughout Chapter 3 of the book. The system is stable
, which means that
an
open

loop simulation is
possible.
I浰me浥湴 瑨攠sy獴敭s楮 SI䵕䱉NK
⸠奯甠浵獴 畳u a渠
‘
inport
’
at the input and and
‘
outport
’
at
the output.
S
imulate
the system
by using the ”control” script. Use a
sampling period of 0.2
seconds. Apply square waves with
different amplitudes (for
example 0.3, 2, and 10). How would a linear system behave differently?
Ide
ntify a neural network model of the system. Select a ”sensible” control
signal
(remember that the system is nonlinear) and simulate approximately 200 seconds.
Split the data set into a training set and a test set of approximately the same size. Train
the n
etwork 'g
1
' to model the system:
and use the test set to evaluate the trained model.
乯N⁵獥⁴桥 ta 琠t漠瑲o楮渠楮癥牳r潤e氬l
Ⱐ潦⁴桥y獴敭㨠
⡔桩猠h猠sa汬e搠
generalized invers
e learning
)
4
The inverse model can now be used as controller for the system. Instead of
the desired output at time
t+1
should be inserted.
Modify
the program 'control.m' to
do this. Let the ”desired” closed

loop system behave as:
and
The first is obtained by setting
;
the second is obtained by a
suitable filtering of the reference signal.
Evaluate the closed

loop system by applying
,
as reference signal
,
square waves of
different amp
litude
.
7. Control with Neural Networks 2
You shou
ld now control the
same
system again,
only this time with a completely different
type of controller. The principle is described in the book, Section 3.7
. It is called pole
placement based on instan
taneous linearization.
The
linearization principle is
briefly repeated
below:
Assum
e that the following neural network model is available of the system under
consideration
and introduce the state vector
At time
t=
,
g
is linearized about the current state vector
, resulting
in the approximate
model:
where
and
5
Under the assumption that equality holds, and by separating
from the rest the part of the
equation
containing components of the current state vector, the appr
oximate model can
alternatively can be written in the form
where
the bias term,
, is given by
The
a
and
b
coefficients have
been collected in
the polynomials
A
and
B
:
In other words, the approximate model can be interpreted as a linear model affected
by an
operating point dependent
DC

disturbance,
.
Utilization of this principle for control of nonlinear s
ystems is straightforward. Consider the
following control system:
Noti
ce the structural similarity with the wel
l

known
indirect adaptive controller
.
The only
difference is that a linear model i
s extracted from a nonlinear neural network m
odel instead
of using a recursive estimation
algorithm
for
estimating
a linear model.
Inc
潲灯oa瑥t 瑨t猠 浥瑨潤 楮i
’
control.m
’
and design two different pole placement
cont
rollers. First try a controller that cancels
the zero and places two poles in
z=0.7
.
Next, let the zero
stay and
place
only
the poles.
Remember to use
integral action to
compen
sate for
(
)
.
The m

function
’
dio
.m
’
can be used for solving the D
iophantine
equa
tion.
Extract
linear model
Control
design
Controller
System
Linearized model parameters
Input
Output
Controller
Parameters
Reference
Enter the password to open this PDF file:
File name:

File size:

Title:

Author:

Subject:

Keywords:

Creation Date:

Modification Date:

Creator:

PDF Producer:

PDF Version:

Page Count:

Preparing document for printing…
0%
Comments 0
Log in to post a comment