You are on page 1of 6

DESIGN OF NARMA L2 NEUROCONTROLLER

FOR NONLINEAR DYNAMICAL SYSTEM


Kittisuk Srakaew, Viboon Sangveraphunsiri, Supavut Chantranuwathana, and Ratchatin Chancharoen
Mechanical Engineering Department, Faculty of Engineering, Chulalongkorn University,
Bangkok, Thailand.
Ratchatin.C@eng.chula.ac.th

ABSTRACT
This paper proposed a technique based on NARMA L2
neurocontroller to control a trajectory of a nonlinear plant.
The NARMA L2 neurocontroller was first trained to
cancel both the nonlinearity and dynamic of the system.
Then, it was reconfigured to become a controller. Once
the NARMA L2 neurocontroller suppresses both the
nonlinearlity and dynamic behaviour, the closed loop
system becomes implicit algebraic relation between the
input and the output. Consequently, the system is able to
perfectly follow a smooth reference trajectory even it is
generated in realtime. This technique was successfully
implemented to control the trajectory of a nonlinear disk
plant to follow a sine sweep trajectory and also to follow
the input device in realtime. Thus, it is a remarkable
candidate for a trajectory controller for a nonlinear
system.
KEY WORDS
Nonlinear Trajectory Control, Neural network.

1. Introduction
The determination of the trajectory of control effort that
gives the output of a nonlinear system to follow a desired
trajectory is a very challenging task since the output
depends nonlinearly on the control effort. Since the
system operates over a large working space, a controller
design based on linear approximation of the system
around a single equilibrium point is not well performed.
The primary aim of this project is to design an accurate
and practical tracking controller to control a nonlinear
plant to follow a varying position reference over a large
working space. In recent years, this problem draws much
and increasing attention from industry since the
mechanical transmission is to be replaced with By-wire
technology in the near future to reduce cost and increase
functions of the devices. For example, the acceleration
pedal of some new vehicles is now using this technology,
i.e., the position of the pedal, sensed by encoders, is used
to control the opening of the throttle via electrical signal
cables. The steer by wire [1] is also coming to the
market. The other applications that need an accurate

675-044

tracking controller are Master-slave devices [2] and high


speed drives robotics [3] and high speed CNC machines
[4]. These machines are nonlinear and operated at high
speed. Thus, a tracking controller should be designed to
handle both behaviors.
The real mechanical systems are nonlinear. The system
normally includes friction, which is hard nonlinear if dry
friction included, the nonlinear gravity effect, and the
varying inertia or load. The classical PID controller does
not well perform when dealing with the mentioned
nonlinear effects, and especially in trajectory following
control. This controller cannot control the system such
that the tracking error asymptotically decreases.
The practical strategy to design an effective trajectory
controller is a technique called computed torque [5].
This technique, the control effort consists of two parts,
namely feedback linearization part and servo part. For the
feedback linearization part, the effort is computed based
on state feedback such that the closed loop system
becomes linear. Once the closed loop system is linear, the
superposition can be applied. Then, the servo parts effort
controls the resulting linear system such that the tracking
error asymptotically decreases to zero. Both parts are
superimposed to form a trajectory controller that gives a
perfect tracking response. In the servo part, the effort is
computed based on not only the tracking error but also its
first and second derivatives. Thus, not only the position
reference trajectory, but also its first and second
derivatives are required as well as the actual position and
its derivatives. Using this technique, the bounded input,
bounded output stability is obtained and the tracking error
is bounded when the bounded disturbance is presented. In
case that the dynamics of the linear system is known
precisely, the position reference and its first and second
derivatives can be combined to generate a new single
reference based on inverse dynamics of the linear system.
In this way, the reference form a trajectory generator is a
single signal that when used to command the linear
dynamical system will give a perfect tracking. Since the
closed loop system is linear, the stability is easily
determined using linear system theory [6].

One difficulty of using the conventional computed torque


technique is that the trajectory generator must provide the
position reference and also its first and second derivatives
and/or the dynamic model of the closed loop system must
be known accurately. In case that the input device is used
as the position reference generator, the first and second
derivatives of the position reference must be computed
real time and thus requiring computation capability of the
hardware and increase cost. The intelligence is also
required to compute and generate a single reference based
on inverse dynamics of the system to command the
dynamical system to perfectly follow a smooth trajectory.
The other problem is that the nonlinearity must be
modeled with sufficient accuracy which normally
required an extensive effort.
To overcome these problems, the control effort is
designed such that it does not only eliminate the
nonlinearity, but also the dynamics of the system. The
closed loop system becomes implicit algebraic relation
between the control effort and the output. The position
reference can be used as reference directly. In this way,
only the position reference is required and the system still
perfectly tracks a smooth trajectory. This technique
promotes higher complexity to the state feedback
controller but make everything else simple. The controller
is also design based on discrete-time neural network
model in order to lessen an effort to model the
nonlinearity and to construct the controller. The discretetime neural network is trained offline using the data pairs
from the operation of the system and then reconfigured to
be a controller. The NARMA L2 controller is designed
based on this concept and is a potential candidate for a
tracking controller.
In this project, the performance of the NARMA L2
neurocontroller is investigated. The NARMA L2 is
designed to control the trajectory of the nonlinear
pendulum plant. The controller is designed such that it
eliminates nonlinear, including hard nonlinear dry
friction, and gravity and also eliminates the dynamic
behavior. Since the NARMA L2 based on neural network
is trained using the input-output data pairs, the
nonlinearity and the dynamics of the system is easily but
efficiently modeled in a single activity. The NARMA L2
neurocontroller is first trained, and then reconfigured to
form a controller that efficiently suppresses the
nonlinearity and dynamics of the system.
The NARMA L2 controller is capable of control the
pendulum plant such that it perfectly tracks the varying
position reference as demonstrated by real time
experimentation. This technique is practical and not too
difficult to construct and implement on real time
controller. Thus, it is a remarkable candidate for a
universal trajectory controller for nonlinear system.

2. Narma L2 Neurocontroller
NARMA stands for nonlinear autoregressive moving
average. It is a discrete-time representation of the
nonlinear dynamical system in neighborhood of the
equilibrium state. When the system is nth order nonlinear
SISO and has a relative degree d.The companion form of
NARMA can be written as [5]
y(k + d ) = F [y(k ), y(k 1),..., y(k n + 1),
u(k), u(k 1),..., u(k n + 1)]
where

u(k) R is the sequence of control effort


y(k) R is the sequence of output
F: R2nR and F C

This model implies that an input at time k affects the


output only at time d later. In other word, the relative
degree, d, represents the delay of the system from control
effort, u, to the output, y. This model is not convenient for
determination of the control effort, u(k), such that the
plant output tracks a desired reference since it is a
solution of the inverse dynamics problem of nonlinear
system. To overcome this problem, two linear
approximations [5] of NARMA are proposed, namely
NARMA L1 and NARMA L2. The relation between the
input, u(k), and the output, y(k), appears linearly in both
approximations, and thus, the control effort, u(k), is easily
determined from algebraic linear equation. The difference
between these two approximations is that the Taylor
expansion for NARMA L1 is around (y(k), y(k-1), , y(kn+1), u(k)=0, u(k-1)=0, , u(k-n+1)=0) while the
Taylor expansion for NARMA L2 is around the scalar
u(k)=0. These two approximation models are given as
NARMA L1
y ( k + d ) = f [ y ( k ), y ( k 1),..., y ( k n + 1)]

n 1
i =1

gi [ y ( k ), y ( k 1),..., y (k n + 1)]u ( k i )

Where
f = F [( y ( k ), ..., y ( k n + 1), 0, 0,..., 0]
gi =

F
u(k i) ( y(k ),..., y(k n+1); u(k )=0,..., u(k n+1)=0)

NARMA L2
y ( k + d ) = f [ y ( k ), y ( k 1),..., y ( k n + 1),

u ( k 1),..., u ( k n + 1)]
+ g[ y ( k ), y ( k 1),..., y ( k n + 1),
u ( k 1),..., u ( k n + 1)] u ( k )
Where

f = F [( y ( k ), ..., y ( k n + 1), 0, u ( k 1),..., u ( k n + 1)]

g=

F
u(k ) ( y(k ),..., y(k n+1); u(k )=0, u(k 1),..., u(k n+1))

2.2 Identification of the NARMA-L2

The identification of the system to be controlled is the


first step to construct the NARMA L2 neurocontroller.
The neurocontroller can be trained offline in batch from
using set of input-output data pairs to approximate the
nonlinear function of f and g.

In NARMA L1 model, the f and g functions are only


functions of the past values of the output, y, and the
control effort, u, and its past values appear linearly in the
equation. In contrast, in NARMA L2 model, the f and g
functions are the functions of the past values of both the
output, y, and control effort, u, and thus, the relation
between the next value of output, y(k+d), and control
effort at the current step, u(k), appears linearly.
NARMA L2 is preferred to be a universal tracking
controller since its realization is simpler compared to
NARMA L1. NARMA L2 consists of only two nonlinear
functions, f and g, which can be modeled using two neural
subnetworks. Both functions have (2n-1) inputs which are
the past values of output, y, and control effort, u. Once the
nonlinear system is approximated and modeled as
NARMA L2, the control effort, u(k), is designed such that
it eliminates both f and g and also the output, y(k+d), is
equal to the reference, yr(k+d). Since the relation between
the control effort, u(k), and the output, y(k+d), is in the
form of algebraic linear equation (not finite difference
equation), the sequence of control effort, u(k), that give
the system output, y(k+d), equal to the reference, yr(k+d),
is easily determined.
2.1 Structure of NARMA L2 neurocontroller

Fig. 2 Identification of the NARMA-L2


2.3 NARMA-L2 Controller

Since the relation between the control effort and the


output in the NARMA L2 model is linear, the control
effort that gives the output equal to the position reference
is easily determined. The control law for this controller is

u(k +1) =

yr (k + d) f [ y(k),..., y(k n +1), u(k),..., u(k n + 1)]


g[ y(k),..., y(k n +1), u(k),..., u(k n +1)]

Once the nonlinear function of f and g are modeled, the


neurocontroller is then simply the rearrangement of these
two subnetworks of the plant model such that the control
law is obtained. The closed loop system can be viewed as
shown in FIG. 3

Z-1

yt+1

Z-1
Z-1
Z-1

W
b
W
W
W
b

W
b

W
b

Fig. 1 The structure of NARMA L2 neurocontroller

yrt+2

The NARMA L2 neurocontroller [FIG. 1] consists of two


subnetworks, f and g. These two subnetworks are
arranged such that the controller cancels not only the
nonlinearity but also dynamics of the system. The
resulting closed loop system becomes implicit algebraic
model, i.e., y(k+d) = yr(k+d). This means that the system
perfectly tracks a smooth trajectory.

Reference
Trajectory

To construct the neurocontroller, the number of delayed


plant inputs and outputs are chosen based on structural
model. The size of the hidden layer is chosen such that the
network can accurately approximate the nonlinearity of
the system. There are two steps to construct the NARMA
L2 controller: identification and control.

g()

ut+1

+
f()

Nonlinear Plant

Fig. 3 Closed Loop system


2.4 Stability

The closed loop system is stable if the plant is a minimum


phase system and the relative degree is well defined.
However, the proof of the controllability, observability,
and stability is not within this paper.

If the sequence of control effort that gives the nonlinear


system to follow a desired trajectory is known to exist and
unique, this technique is capable of solving to find those
sequence.

The Matlab NARMA L2 blockset implemented on the


Matlab xPC realtime target PC is used to control the
trajectory of the disk plant. The target PC is Pentium
processor with 100 MB RAM with the AD 8133 and AD
726 cards installed. The drivers for all cards are
developed such that the highest speed is obtained. The
sampling is set to 0.005 second.

3. The Nonlinear Disk Plant


3.1 The Implementation of NARMA L2 Neurocontroller

The plant model 220 from Educational Control Products


(ECP) [FIG. 4] is modified and then used to demonstrate
the performance of NARMA L2 controller. The plant has
several mechanisms for adjusting the load inertia, and
gear ratio and can simulate several types of friction,
backlash, and drive flexibility. The modified plant
consists of two disks. The smaller disk is designed to be
an input device to generate the position reference in real
time while the bigger disk is the nonlinear plant. The
driven motor is a brushless DC servo motor coupled with
4000 PPR encoder. The DSP controller that comes with
the plant is replaced by The Matlabs xPC real time
controller, which is used to implement the neurocontroller
and to control the system in real time.


y (t ) + f ( y (t )) mgl sin(y (t ))=u (t )
This is a second order nonlinear plant which can be
modeled as n-dimensional discrete time as

] [

y(k + 2)=f y(k + 1), y(k ) + g y(k + 1), y(k ) .u(k )

The control input to the plant is in the form of:

u(k +1) =

yr (k + d) f [ y(k), y(k 1)]


g[ y(k), y(k 1)]

Thus, the parameter of the NARMA L2 neurocontroller is


chosen as
The number of delayed plant inputs:0
The number of delayed plant outputs:2
The size of hidden layer: 5
The sampling interval: 0.005

Input (volts)

The bigger disk, which is used as the nonlinear plant, is


installed with rubber to generate real dry friction and the
brass mass is installed such that the gravity effect is
nonlinear.

The model of the nonlinear plant can be written as

Pendulum Position (rad)

a) Mechanical Plant

b) Matlab xPC Real time Controller


Fig. 4 The ECP model 220 Disk Plant

Fig. 5 Training data pairs


The NARMA L2 neurocontroller is trained offline using
the 12000 data pairs [FIG. 5] collected from the operation

of the plant. The data pairs consist of random input signal


and y is sampled at 100 Hz sampling frequency. Data
pairs are divided into two parts; training data intended for
training the NARMA-L2 model and validate the model.
The training epoch is set to 1000 and the LevenbergMarquardt backpropagation technique [8] is used to train
the network.
Once the NARMA L2 neurocontroller is configured and
trained, it is implemented on the Matlabs xPC real time
controller as described earlier. The sampling is set to
0.005 second.

4. Experimental Results
In the first experiment, the trajectory is sine sweep
internally generated by real time controller. The initial
position of the system is not on the trajectory at the
beginning. The NARMA L2 neurocontroller quickly
bring the system to the trajectory but the chattering is
observed. This is because the computed control effort to
rapidly bring the system to the trajectory is quite high and
exceeds the hardware limit. The control effort is then
saturate at the maximum possible effort. However, the
control effort decreases when the system is near the
reference trajectory. The chattering is also decreasing.
When the computed control effort is within the hardware
limit, the neurocontroller successfully control the system
to stay on the reference trajectory. The tracking response
to the sine sweep is both in phase and magnitude ratio is
one. The NARMA L2 is a linear approximation about
u(k)=0 and gives a perfect response when the system is on
the trajectory. At this time, the control effort, u, is around
the zero value.

controller when controlling a nonlinear system in the


trajectory following mode [FIG. 6].
In order to suppress the chattering, Pukrittayakame et al.
[9] suggested an adjunction of a linear feedback to the
NARMA-L2 controller to smooth the control action. The
addition of a linear feedback to the NARMA-L2
controller is equivalent to the feedback linearization
control methodology. This technique installs the dynamic
behavior back to the closed loop system. The drawback is
that the position reference should be corrected in order to
give a perfect tracking.
In the second experiment, the reference trajectory is
generated in real time using input disk. The input disk is
manually rotated and thus the reference trajectory is
arbitrary. This experiment demonstrates that NARMA L2
neurocontroller is capable of control the system to track
the input reference [FIG. 7]. Again, the tracking response
is both in phase and true magnitude. The NARMA L2
neurocontroller is an outstanding candidate for trajectory
controller and obviously outperform the classical PID
controller.
Tracking Response
Reference Trajectory
Pendulum Trajectory using NARMA L2

3
2
1
0
-1
-2

Pendulum Trajectory using PID


Tracking error, NARMA L2

-3
0

10

Time (s)

Fig. 7 Tracking to an arbitary input reference

5. Conclusion

Fig. 6 Tracking to sine sweep reference


The tracking response of the classical PID controller
demonstrates that the PID is not an efficient trajectory
controller. The phase of the tracking response lags the
reference trajectory and there is also an error in the
magnitude that depends on the frequency of the reference.
The NARMA L2 obviously outperforms the PID

The NARMA L2 neurocontroller is a discrete-time


controller that has internal feedback of past control effort
and output, designed to eliminate not only the
nonlinearity but also the dynamic behavior of a nonlinear
system. It is able to transform a nonlinear dynamical
system into an implicit algebraic model and thus easily
but efficiently control the trajectory of the system. The
control effort is computed based on the position reference
directly and its derivatives are not required.
In this project, the NARMA L2 neurocontroller
successfully implemented to control the real nonlinear

mechanical system, the pendulum system. The results


demonstrate that the NARMA L2 neurocontroller
perfectly control the nonlinear system to follow the
smooth desired trajectory, even though the trajectory is
generated in real time.
This technique effectively integrates the discrete-time
model and the discrete-time controller techniques such
that signal conversion is minimized and thus also error.
Derivatives of signals are also effectively managed. This
results in an effective but simple trajectory controller.

Acknowledgement
This research is sponsor by the Chulalongkorn university
century academic development project.

References
[1] P. Setlur, J. R. Wagner, D. M. Dawson and D.
Braganza. A Trajectory Tracking Steer-by-Wire
Control System for Ground Vehicles, IEEE
Transactions on Vehicular Technology, vol. 55, no. 1,
pp. 76-85, January 2006.
[2] Y. Yokokohji and T.Yoshikawa. Bilateral Control of
Master-Slave Manipulators for Ideal Kinesthetic
Coupling-Formulation and Experiment, IEEE
Transactions on Robotics & Automation, vol. 10, no.
5 , pp. 605-620 DC, October 1994.
[3] A. Kamalzadeh and K. Erkorkmaz. Accurate tracking
controller design for high-speed drives, International
Journal of Machine Tools & Manufacture, vol. 47, pp.
1393-1400, December 2006.
[4] K. Erkorkmaz and Y. Altintas. High speed CNC
system design Part III: high speedtracking and
contouring control of feed drives, International
Journal of Machine Tools & Manufacture, vol. 41,
pp.1637-1658, 2001.
[5] R. H. Middleton and G. C. Goodwin. Adaptive
computed torque control for rigid link manipulations,
Systems and Control Letters, vol. 10, pp. 9-16, 1988.
[6] J E. Slotine and W. Ping., Applied Nonlinear Control.
Prentice Hall, New Jersey, 1991.
[5] K. S. Narendra and S. Mukhopadhyay. Adaptive
control using neural networks and approximate
models, IEEE Transactions on Neural Networks, Vol.
8, pp.475-485,1997.
[8] L.S.H. Ngia and J. Sjberg. Efficient training of
neural nets for nonlinear adaptive filtering using a
recursive Levenberg-Marquardt algorithm, IEEE
Transactions on Signal Processing, vol. 48, pp. 19151927, 2000.
[9] A. Pukrittayakame, O. De Jesus and M.T. Hagan.
Smoothing the control action for NARMA-L2
controllers, Midwest Symposiom on Circuits and
System, vol.3, pp: III 37-40, 2002.

You might also like