Session 12b6

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Session 12b6

0-7803-5643-8/99/$10.00 1999 IEEE November 10 - 13, 1999 San Juan, Puerto Rico
29
th
ASEE/IEEE Frontiers in Education Conference
12b6-7
Hardware-in-the-loop simulation and its application in control education
Wojciech Grega
Department of Automatics, University of Mining and Metallurgy
30-059 Krakow, Al.Mickiewicza 30, Poland
wgr@aquarium.ia.agh.edu.pl

Abstract This paper describes the concept of hardware-
in-the-loop design system implemented as an experimental
part of the control engineering course. The concept of
hardware-in-the-loop (HiL) method is to use a simulation
model of the plant and the industrial standard target
controller. The integrated analysis and simulation
environment supports the design system. Hardware and
software components of the HiL system are presented in the
paper and an example of the laboratory exercise is
described to give insight into the approach, which has been
adopted.
Introduction

It has long been recognised that the laboratory experiment
is an important way in which abstract concepts of
engineering can be related to the design problems. This is a
particulary true in control engineering education. Students
find the control theory hard to understand, limited in its
application and become less well motivated. Therefore, the
use of laboratory exercises which illustrate the theory at
work in practical situations is an important aspect of control
engineering education [1],[2].
The original motivation behind constructing laboratory
scale models of industrial processes was to offer the students
an environment for a complete engineering design, starting
from modelling and simulation and ending with the
experimental verification of a wide range of control
strategies. A typical integrated real-time control and
simulation environment contains three main parts: analysis
and simulation software, a target controller and an
experimental set-up. The software includes controller
design/analysing tools, real-time code generators and a
compiler. The target hardware can be based upon DSP
techniques or other low-cost alternatives such as PC-based
controllers or microcontrollers can be used.
Usually the costs of the first two components are much
lower in comparison with the costs of the experimental set-
up. Capturing the realism of industrial control problems
requires a complex installation or machinery, both costly
and inflexible, in some cases potentially dangerous for the
students.
The concept of hardware-in-the-loop (HiL) method
is to use a simulation model of the process and the real
target hardware. The simulation model provides all the
process signals in real-time that are next converted by D/A
modules and supplied to the controller as voltages. The
control signals are produced by the controller and supplied
via A/D converters to the simulation model. It is the
purpose of this configuration to make the hardware
component behave as closely as possible to these that would
be encountered in the real system.
The paper is organised as follows. In the first section
the concept of the integrated real-time control and
simulation environment is explained. Next, we describe
hardware and software components of the HiL design
system and present the application of the HiL method for
control of the ventilation system. Finally, the benefits of the
proposed solution are discussed and compared with other
alternatives.

Computer-aided control system design and
real-time control

A typical development cycle of control system design
and implementation is given in Figure 1.

control
& monitoring
real-timetasks
Design
Process
analysis
Matlab
Process
simulation
Simulink
CACD tools
4
<
:
AF B F AB AF B AF B AB F AF B AF B
C
P
1
B
code writing
compilation
loading
identification
target controller

Figure 1. Typical development cycle of a control system

Session 12b6
0-7803-5643-8/99/$10.00 1999 IEEE November 10 - 13, 1999 San Juan, Puerto Rico
29
th
ASEE/IEEE Frontiers in Education Conference
12b6-8
The design process starts with determination of goals
and modelling of the process to be controlled, and ends with
experiments. Modelling is to formulate a mathematical
description that characterises the input-output relationships
of the process to be controlled. The model can be obtained
be applying physical laws or by identification experiments.
This is followed by a design phase, which requires selection
of control strategies, structures and parameter values.
Nowadays, designing methods are supported by computer-
aided analysis and simulation tools [3]. Most of them aid
the control system engineer with a complete software
environment for the analysis and synthesis aspects of
control systems. The analysis, modelling and simulation
cycle is iterative.
After the design process is completed the
implementation phase requires translation of a control
algorithm into the real-time control code. The main
features of the real-time software, as distinct from other
software, are that the control algorithms must be run at
their scheduled sample intervals and that there exists
associate software components, which interact with the
sensors and actuators. This implementation phase requires
from student some skills beyond the basic application of
programming languages, like interrupt handling,
interaction with an external hardware, task scheduling.
Finally, the control code is loaded to the target
controller. The controller is then integrated with the
physical system for further tests, using physically measured
inputs and generated outputs. The implementation
procedure can also be performed several times with
modified parameters or structures of the control algorithm
until the design goals are met.
In recent years the development of computer-aided
control design tools has changed the control systems design
practice significantly, both in industry and educational
sectors [4], [5]. The Integrated Real-time Control and
Simulation Environment (IRCSE) is a tool enabling the
designer to perform simulations and real-time experiments
in structured and simple manner.
Typically, the IRCSE consists of three main parts
(Figure 2):
real-time part, referred as a real-time kernel (RTK),
analysis and simulation software available in on-line
mode,
generator of real-time code.
The real-time kernel (RTK), installed on the target
controller, performs the interfacing operation, control
algorithm and data logging. Data collected in the cyclic
buffer of the real-time kernel are transferred to the CACD
environment and are available in on-line mode. A special
Graphical User Interface (GUI) is created for on-line
visualisation of process data. The main advantage is the
possibility of using simulation and analysis procedures as
remotely communicating programs including interactive
on-line parameter tuning.

control &
communication
real-time tasks
Design
Process
analysis
Matlab
process
simulation
Simulink
CACD tools
:
AF B F AB AF B AF B AB F AF B AF B P
P
1
B
code generator
compilation
loading
GUI
on-line tasks
target controller


Figure 2. Development cycle of a control system in the
IRCSE

The code generator supports rapid prototyping of the
control algorithm. The code generator produces a run-time
code based on the controller designed in the CACD
environment. Figure 3 shows the general concept that
comes within the scope of the code generator. We wish to
use simulation tools to design, test and analyse a model

B B B B B B B
C
+
Model
of the process
Model
of the controller
Model
of the controller
Input
Driver
Output
Driver
Real-time control algorithm

Figure 3. Controller rapid prototyping

Session 12b6
0-7803-5643-8/99/$10.00 1999 IEEE November 10 - 13, 1999 San Juan, Puerto Rico
29
th
ASEE/IEEE Frontiers in Education Conference
12b6-9
of a control system. Once the project is complete we can
add an appropriate input/output drivers to generate an
executable code directly from the block diagram. The code
generator software translates the controller diagram into its
equivalent code representation, adding functions that are
unique to the target controller. This solution offers
automation of the controller design freeing the designer
from the burden of manual PLC programming.
The concepts presented above are supported by a
number of commercially available or originally developed
rapid prototyping tools (see Table 1). Educational
applications focus on personal computers (PCs) which,
along with a related real-time extension of the Windows
95/98/NT operating systems, can provide low cost solutions
to the process control of small plants or laboratory
installations.

Table 1. Examples of IRCSE & rapid prototyping software tools
Product Target
Platform
CACD environment Visualisation tools Remarks
dSpace (dSpace-
GmbH)
DSP MATLAB/SIMULINK SIMULINK high-speed control
and data analysis
Paradym (Intellution) PLC, industrial
PC
Sequential function
charts, function blocks
FIX-Intellution industrial
standard:IEC 1131-3
RT-CON (Inteco Ltd) PC, PLC MATLAB/SIMULINK SIMULINK low-cost solution


What makes this approach especially effective for
educational applications is the general assumption that the
integrated environment creates an open architecture
process automation system. It uses a standard hardware
platform, standard operating system and commercial
Computer Aided Control Design Systems as engineering
tools. MATLAB, a popular model analysis package and
SIMULINK, object oriented dynamic system simulation
package, were selected as CACD tools in the application
described in this paper. They include a number of toolboxes
for signal processing, system identification, and control
design, both for linear and non-linear, single input - single
output (SISO) and multi input-multi output (MIMO)
systems. However, drivers for communication between the
RTK and analysis/simulation software are not included in
the standard versions. To overcome this interprocess
communication functions must be developed as an
extension of MATLAB software to allow data transfer
between the real-time part and the CACD. The code
generator uses Real Time Workshop toolbox supported by
RT-CON software a group of tools meant to cover the
different realtime code generation stages in the
Windows95/98/NT environment.

Laboratory scale models in control education

The original motivation behind constructing laboratory
scale models is to illustrate theory at work in practical
situations and to offer the students an environment for a
complete engineering design, starting from modelling and
simulation and ending with the experimental verification.
The laboratory sessions attempts to reflect the industrial
aspects of control engineering by carrying out application-
oriented projects. The general assumption is to capture the
realism of industrial control problems in a laboratory
environment. In many cases development of the models is
stimulated by industrial-commercial applications of new
results. In this respect some typical areas were selected in
control laboratories to be representative as the prototypes of
realistic computer controlled processes from the various
branches of control system engineering: electromechanical
systems [6],[7] (inverted pendulum, helicopter model,
digital servo, magnetic bearing, simple robots), fluid-level
control [8], thermal and chemical process control (e.g. PH-
control). In most cases the technical importance of the
models is immediately evident for the students allowing
them to relate the theory to the physical world.
However, more complex laboratory models of
industrial plants are too expensive for control education.
The isolated initiatives in the development of prototypes of
complex laboratory installations were reported, but always
supported by industry or research grants.
As a matter of fact, experimental verification of control
algorithms requires a computer-controlled source of the
process signals. For example, the signals can be produced
by a simulation model of the plant and supplied via D/A
converters to the PLC controller. The only requirement is
real-time behaviour of the simulation model. This concept is
described in the next section.

Hardware-in-the-loop simulation

Generally, a classical control experiment requires a direct
connection with the plant (Figure 4).
A plant or its laboratory model delivers physically
measured inputs. Generated outputs are send to the
actuators: motors, valves, amplifiers, etc. This is a classical
Session 12b6
0-7803-5643-8/99/$10.00 1999 IEEE November 10 - 13, 1999 San Juan, Puerto Rico
29
th
ASEE/IEEE Frontiers in Education Conference
12b6-10
design approach based on experimental validation of the of
the control algorithm.

POW
GE
PROG
+
2
4
1
0
A/DD/A RS
PLC
plant
I
devicebus


Figure 4. Classical control experimental set-up

However, we can easily imagine a reverse situation,
when the process from Figures 4 or 2 is substituted by its
model and is being simulated in real time. The controller is
fully implemented in this case. This approach is called
hardware-in-the loop simulation. The simulated plant
provides all input signal to the real PLC controller (Figure
5). In this scenario fully programmed, industrial standard
controller interfaces with real-time simulation.

B 1 2 B 1 2 B 1 2 B 1 2 B 1 2 B 1 2 B 1 2 B 1 2 B 1 2
POWE
PROGR
+
2
4
1
0
A/D D/A RS
PLC
PC1
PC2
I/O board


Figure 5. Hardware-in-the loop method

This general concept was first implemented by
dSPACE GmbH company [9] resulting in a line of products
based on TMS320 DSP processors and specialised toolboxes
for hardware-in-the-loop simulation. The dSPACE Real-
Time Interface offers automation of the hardware-in-the-
loop experiments supported by high-speed of digital
processor system. The only drawback of this configuration
is the price: the code generation software is very expensive
due to its small market share.
The proposed system consists of an industrial-standard
programmable logic controller (PLC), the PCtype
computer where the simulation model is located (PC1) and
another PC used for PLC code development (PC2). The
low-cost input/output board is plugged into slot of the PC1
computer. The board features 16 analog input channels, two
analog output channels and 16 configurable digital I/O
channels.
The key to hardware-in-the-loop simulation method
lies in the software. In this experimental set-up the software
includes (Figure 6):
tools for modelling and simulation
(MATLAB/SIMULINK), available as a low-cost
educational licence,
library of I/O drivers: a set of pre-defined blocks,
representing the functions implemented in hardware,
code generation software for automatic building of real-
time models (RTW, RT-CON software),
user-interface for visualisation of data and on-line
tuning of the parameters.

A/D
WINDOWS 95/98/NT, RTW
Real time kernel
I/O board
visualisation
from sensors
D/A
to actuators
I/O driver
MATLAB/
SIMULINK
communiction
interface
tunning
real-time
model
A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 POWE
GE
Fan
PROGR
AMMAB
+24
V
100-
PLC controller
A/D
D/A
Digital
I/O



Figure 6. HiL software and hardware architecture

The major functions assigned to the particular parts of
this software environment are as follows:
development of the simulation model of the plant
(MATLAB/SIMULINK). Next, the model is supplied
Session 12b6
0-7803-5643-8/99/$10.00 1999 IEEE November 10 - 13, 1999 San Juan, Puerto Rico
29
th
ASEE/IEEE Frontiers in Education Conference
12b6-11
with drivers appropriate for the I/O board,
translation of the simulation model into C-code (RTW,
RT-CON), compilation and loading,
run-time monitoring and data logging (MATLAB and
SIMULINK).
Another part of the system is used for programming of
the PLC. A design software, located on the PC2 computer,
is usually delivered by the manufacturer of PLC.

Case study: tuning controller for a ventilation
system

Heating, ventilating and air-conditioning systems in the
buildings are complicated processes consisting of
interconnected electromechanical and thermal systems. The
importance of well design controls for such a process
becomes evident when one considers the potential impact of
the ventilation system controls on the economy and the
environment [10].
Figure 7 shows the schematic diagram of one type of
air-handling units. The unit is used to control the
temperature in a building zone. The unit consists of the
blower supplying the air duct, the heat exchanger and three-
way valve controlling the water flow through the heat
exchanger. The temperatures are measured be the sensors
inserted into the air stream. The objective of the PLC
controller is to maintain the output temperature at the
setpoint.
valve
position
Tpout
Tpin
Twout
three-way
walve
air
pump
hot water
blower

Figure 7. Diagram of the heating unit

Figure 8 presents the configuration used for HiL
control of the ventilation system. The system utilises GE
Fanuc PLC as a target hardware and real-time SIMULINK
model of the ventilation system. The model represents a
complete dynamics of the heating unit, the valve and
includes nonlinearities observed in the system. The model
supplies PLC controller with sensor inputs (tpin, tpout
twout) and accepts the control signal (valve position) in
real-time. The PC-type host computer has on-line access to
all parameters and variables of the simulated process. The
GUI tools available in SIMULINK are used for on-line
visualisation of the model and controller outputs.

A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 A 1 2 3 B 1 2 3 POWE
GE
Fan
PROGR
AMMAB
+2
4
V
1
0
0-
Val ve posi t i on
0 - 1 0 0 %
wat er
t emper a t ur e
air
t emper a t ur
f l ow of t he wat er
0-no f l ow
1-max. f l ow 3
co st s
Twout
Tpou t
al f a_n*p_n
al f a*pow
-K-
t emp. of i nput
wat er
Sum8
Sum7
Sum6
Sum5
I n Out
val ve
Product 9
Product 14
Product 12
Product 11
Product 10
1
co st s
1 KJ
energy
s
1
I nt egrat or2
s
1
I nt egrat or1
s
1
I nt egrat or
-K-
Gw/ Qw
-K-
Gw* cww
-K-
1/ Qw* cww
-K-
1/ Qp* cwp
-K-
1/ Qp
Input
I nput ai r
t emper at ur e
2
Tpin
Input air f low
m^3/h
kg/ s
Str
-K-
3
PL C:
process dat a
PLC: cont rol
I nput dat a
generat or
Tpin

Figure 8. Real-time simulation model applied for HiL control
Session 12b6
0-7803-5643-8/99/$10.00 1999 IEEE November 10 - 13, 1999 San Juan, Puerto Rico
29
th
ASEE/IEEE Frontiers in Education Conference
12b6-12

Graduate students in Automatics and Robotics have
employed the HiL method for designing PLC data
acquisition and control algorithms. They were using
heating/ventilation example from Figure 7 and multi-tank
example from Figure 4. The projects had resulted in reports
of high quality. In almost all cases students after
understanding the manuals were able to follow all the steps
of the designing procedure and get to the final results
during a standard 4-hours laboratory session.

Conclusions

This is an important aspect of control engineering as
without the realisation that the theory can be directly
applied to industrial situations it might be taught only as an
applied mathematics course. Students need to put the theory
they learn into practise, which includes development of the
complete project and experimental verification of the
design. Often, the control projects are not complemented by
practical activities due to high cost of laboratory equipment.
It is important problem of the balance between the desirable
objective of teaching and cost of training equipment.
In this context the integrated design and rapid
prototyping environment extended by hardware-in-the-loop
method proposed in this paper facilitate the experimental
phase. Benefits of incorporating this approach into control
education include:
application of new design methods. With the
availability of CACD systems and rapid prototyping
path students and researches can verified several newly
development methods in a short time,
application of industry-standard PLC controllers.
Student are able to practice the use of industrial
controllers and accompanying programming tools,
low-cost reflection of industry trends. Laboratory pilot
plants still in use for laboratory work are unreliable and
available only for limited number of students.
Significant reduction of costs and increase of teaching
effectiveness can be achieved by incorporating of the
hardware-in-the-loop method in the laboratory. High
quality software tools for modelling and simulation
allows development of real-time simulation models
capturing the realism of complex industrial plants.
The application of the hardware-in-the loop method
should not be overemphasis as the only controller
implementation. Simple laboratory scale models must be
offered to the students to prevent them from
misunderstanding the role of simulation models.




References

1) Wellstead P.E., Teaching control with laboratory scale
models, IEEE Transactions on Education, 1990, vol.33,
no.3, p.286,.
2) Grega W., Doughty D. Open architecture environment
for control engineering education", in: Computers in
Education, Chapman & Hall, 1995, London, pp. 517-
530.
3) Celier F.E., Schooley L.C., Computer-aided Design of
Intelligent Controllers: Challenge of the Nineties,
Recent Advances in Computer-Aided Control Systems
Engineering (M.Jamshidi ed.), Elsevier 1992, pp.53-77.
4) Ravn, O., Szymkat, M., The evolution of CACSD tools
a software engineering perspective, Proceedings of
the IEEE/IFAC Symposium on Computer-Aided Control
System Design CACSD92, March 17-19, 1992, pp.
225-231, Napa, USA.
5) Grega, W., Integrated Environment for Real-time
Control and Simulation, Computers in Industry, 1996,
vol. 31, pp.3-14.
6) Sasaki N., Ohyama Y., Ikebe J., Design Exercises for
Robust Controller Using a Double Inverted Pendulum,
Proceedings of the 4
th
IFAC Symposium on Advances in
Control Education, July 14-16, 1997, Istanbul, pp. 301-
306.
7) Juang, J-C., Controller Rapid Prototyping and Its
Incorporation in Control Education, Proceedings of the
4
th
IFAC Symposium on Advances in Control Education,
July 14-16, 1997, Istanbul, pp. 363-368.
8) Grega W., Maciejczyk, A., Digital control of a tank
system, IEEE Transactions on Education, 1994,
vol.37, pp. 271-276.
9) Hanselman, H., Hardware-in-the- Loop Simulation for
Development and Test of Electronic Control Units
Proceedings of the Real-Time System93 Conference,
January 13-15, 1993, Paris, France.
10) Haines, R.W., Hittle, D.C., Control Systems for
Heating, Ventilating and Air Conditioning, Van
Nostrand Reinholsd, New York, 1993.

Acknowledgement
This work was supported the grant of the University of
Mining and Metallurgy in Krakow.

You might also like