Professional Documents
Culture Documents
Proceedings of IMECE2013
ASME 2013 International Mechanical Engineering Congress & Exposition
November 15-21, 2013, San Diego, California, USA
IMECE2013-65568
TEACHING NEURAL NETWORK CONTROL SYSTEM DESIGN USING A LOW-COST
RAPID CONTROL PROTOTYPING PLATFORM
Francisco Franquiz
Graduate Student
M.S. Aerospace Engineering
Embry-Riddle Aeronautical University
Daytona Beach, Florida, 32114
Email: franquif@my.erau.edu
Alecia Hurst
Graduate Student
M.S. Mechanical Engineering
Embry-Riddle Aeronautical University
Daytona Beach, Florida, 32114
Email: hursta@my.erau.edu
Yan Tang
Assistant Professor
Mechanical Engineering
Embry-Riddle Aeronautical University
Daytona Beach, Florida, 32114
Email: yan.tang@erau.edu
ABSTRACT
This paper presents the use of a low-cost rapid control
prototyping platform, HILINK, in teaching a graduate course
on neural network control system design for mechanical
engineering students. The HILINK platform offers a seamless
interface between physical plants and Simulink for
implementation of hardware-in-the-loop real-time control
systems. With HILINK, student can quickly build a neural
network controller for applications using Neural Network
Toolbox in Simulink. As a result, students can use one single
environment for both computer simulation and hardware
implementation to understand theories and tackle practical
issues in a limited time frame. The paper presents the
experimental setup and implementation process of the
NARMA-L2 controller for DC motor speed control, and
demonstrates the convenience and effectiveness of using
HILINK in developing a neural network controller.
INTRODUCTION
In advanced control courses, students may often lose
interests if the contents heavily focus on theories. Students
want to see how theories work through both computer
simulations and hardware implementation [1-3]. Therefore,
instructors need to include both simulation assignments and
hands-on activities in curricula to keep students motivated and
engaged. Choosing the right tool for simulation and
implementation will speed up the design process significantly.
Simulink has been the most popular choice for control system
simulations as it has a block diagram based graphical editor and
students can quickly build computer models of a control
system.by using simple drag-and-drop operations to copy the
block diagram of the control system [4]. On the contrary,
hardware implementation often creates a steep learning curve
for students who do not have working knowledge of
mechatronics and programming if they need to hand code the
target microcontroller. These students might not be able to
finish the hands-on activities successfully due to the time
constraints and their low tolerance of frustrations. As a matter
of fact, such situations can be avoided by using the code
generation capability, named Simulink Coder, in Simulink.
Simulink Coder (formerly Real-Time Workshop
) enables
students to automatically generate C and C++ codes for the
target microcontroller directly from their Simulink models,
therefore it eliminates the need to hand code microcontrollers.
This practice has been widely used in industry though it has not
received much attention in classroom. One possible reason is
that instructors might intend to avoid using code generation as
students are expected to have basic programming skills.
Although code generation will speed up controller
implementation, tuning controllers might seem to be time
consuming and painful for students if they cannot evaluate the
effects of changing control parameters in real time. If that is the
2 Copyright 2013 by ASME
case, the Real-time Windows Target could enhance the
learning experience as it enables students to observe the
plants immediate response when parameters are changed.
With the aforementioned benefits (i.e. a single
environment for simulation and implementation and real-time
turning) in mind, we naturally chose Simulink instead of
Matlab for the intelligent control course ME 595F which
covers neural networks and fuzzy logic. However, the
microcontroller selection encountered a dilemma as we
intended to choose a platform compatible with the Student
Version of Simulink while providing both benefits.
Unfortunately, Real-time Windows Target is not available
on the Student Version, so the choice of microcontrollers is
very limited because very few microcontrollers can
implement real-time tuning in Simulink without Real-time
Windows Target. HILINK (Figure 1) became our final
selection because it uses Simulink as the single environment
for both simulation and implementation and does not require
Real-time Windows Target for real-time tuning. HILINK,
developed by Zeltom, LLC, is a low cost, real-time control
board designed for implementation of hardware-in-the-loop
real-time control systems. It provides a variety of I/Os and
includes Simulink library blocks (see Figure 2) associated
with each input and output. Students can simply drag-and-
drop these blocks to create connections between the Simulink
model and external hardware.
Figure 1: HILINK Hardware
Figure 2: HILINK SIMULINK Library Input and Output
Blocks
We intend to share our experience of using HILINK as a
hardware platform in teaching advanced control courses
through this paper. We will present how HILINK is used in
developing and implementing a neural network controller for
the DC motor speed control. The paper is organized as follows:
we first describe the experimental setup for the DC motor speed
control. Then we explain the NARMA-L2 controller design
process using the neural network toolbox, followed by results.
The paper concludes with the summary of experiences in using
HILINK and our recommendations for interested instructors in
control engineering education.
EXPERIMENTAL SETUP DESCRIPTION
As a typical control problem, speed control of a DC motor
was also used in ME595 so students can compare the neural
network control design with the PID control they are familiar
with. The DC motor speed control system consists of a PC
running Simulink, a DC motor with encoder, and HILINK
which transfers the control signal and the sensor measure
between the PC and the DC motor through a serial port, as
shown in Figure 3 without PC.
Figure 3: HILINK board (right) and DC motor (left) setup.
HILINK has a broad range of inputs and outputs including
eight analog inputs, two capture inputs, two encoder inputs, one
digital input, two analog outputs, two frequency outputs, two
pulse outputs, and one digital output. , some of which are
multiplexed. For the DC motor speed control application, only
the encoder input and one pulse output for the sensor
measurement and the control signal, respectively (see Figure 3).
The board interfaces via a serial port with a host computer
running Matlab/Simulink. A HILINK library to allow for
accessing HILINK hardware inputs and outputs is included for
integrating with Matlab/Simulink in a real-time Windows
environment (Figure 2). The real-time operation for the
HILINK platform operates to a maximum 3.8 kHz sampling
rate.
The DC Motor is a 12V brushed permanent magnet motor
with a 12 bit encoder with 1024 pules per revolution (the angle
resolution of 2 / 4096 rad). The computer used in this project
is Dell Precision T3600 running 64bit Windows 7 and has 2G
RAM. The suite of required software includes Simulink 7.9,
Neural Network Toolbox 7.0.3, and HILINK software 1.5.
Serial Connection
Power Supply
H-Bridge
Connection
Encoder
Connection
3 Copyright 2013 by ASME
The information exchange between the host computer and
the DC motor is executed by a simple Simulink model shown
in Figure 4. The blocks E0 and H0 represent the encoder input
and the H-bridge PWM output, respectively. The transfer
function, 1/ (0.09 1) s , is a low pass filter to smooth out the
captured encoder signal, and Gain2 is used for unit conversion
so users can choose speed output either in rad/s or rpm. As the
power supply voltage is 12V, Gain3 takes the value of 1/ 12
to represent the duty cycle of the output PWM signal. The
Out1 and In1 in Figure 4 represent the encoder output velocity
and the controller input of the masked model shown in Figure
5.
Figure 3: DC motor plant HILINK interface sub-blocks.
Figure 5: DC motor plant block diagram.
It can be easily seen from the above description that
programming HILINK can be done within minutes by simple
drag-and-drop operations as the I/Os have been represented
by Simulink library blocks.
Next, we will present the neural network controller design
and implementation.
CONTROLLER DESIGN AND IMPLEMENTATION
The Neural Network Toolbox is used for controller
design as it provides three popular neural network
architectures for control including model predictive control,
NARMA-L2 control, and model reference control [7].
NARMA-L2 was chosen as the controller requires the least
computation of these three architectures [7].
The design of NARMA-L2 controller goes through two
stages: system identification and control design. First, a neural
network model of the plant is developed and trained offline in
batch form. Then the controller is simply a rearrangement of
the neural network plant model.
A Simulink model for NARMA-L2 control of DC motor
speed control is created as shown in Figure 6. The blue
block represents the NARMA-L2 provided by Neural
Network Toolbox. As described in the previous section, the
masked block, named DC Motor Plant, handles the control
and measurement signal transfer between the computer and the
DC motor. The signal generator provides the reference signal
for the DC motor.
Figure 6: Block diagram of entire control system model.
NARMA-L2 Controller
The Nonlinear Autoregressive-Moving Average (NARMA)
model represents general discrete-time nonlinear systems.
NARMA-L2 control linearizes non-linear system dynamics by
transforming the nonlinearities. For this case, the plant model
and the training model are the same form, so the control is
referred to as NARMA-L2 rather than feedback linearization
(Figure 5). The NARMA-L2 uses an approximate model
(companion form) to represent the system:
(k + d)= f[y(k), y(k 1),, y(k n + 1), u(k 1),, u(k m +
1)]+
g[y(k), y(k 1), , y(k n + 1), u(k 1),, u(k m + 1)] u(k)
where y(k) is the system output, u(k) is the system input, and
the format y(k+d)= yr(k+d) indicates the system output follows
a reference trajectory. To avoid realization problems, the
NARMA-L2 model typically used is
y(k + d) =f[y(k), y(k 1), , y(k n + 1), u(k), u(k 1), , u(k
n + 1)]
+ g[y(k),, y(k n + 1), u(k),, u(k n + 1)] u(k + 1)
where d 2. As a result, the controller becomes
( +1) =