2011 - A HiL Test Bench For Verification and Validation Purposes of Model-Based Developed Applications Using Simulink and OPC DA Technology PDF
2011 - A HiL Test Bench For Verification and Validation Purposes of Model-Based Developed Applications Using Simulink and OPC DA Technology PDF
/Simulink
as a simulation
environment and the OPC DA (OLE for Process Control
Data Access) specification as communication interface for
data interchange with the OPC compliant (set as working
condition) target hardware. The main focus of this work was
to offer a tool or an instrument to end user or test engineer
that helps testing auto- generated embedded software while
running on target system and making decision and
statements about correct functionality and performance with
regard to main requirements in order to validate the
intended mission of the application aimed to reach.
1. Introduction
One of the big challenges of embedded application industries
nowadays is to launch superior quality products at lower cost for
sale on the market as fast as possible or in a short TTM. TTM
stands for Time-to-Market and represents the length of time it
takes since the idea of a product has been conceived until the
product has been available for sale. This period of time
represents a crucial factor and plays an important role in
industries due to the big competition between the market leaders
and taking into account that products are outmoded quickly and
have to be updated and extended as fast as possible in order to
meet market needs. The more complex and various are the
embedded activities intended to achieve, the more complex, time
consuming and error- prone is the belonging hand-written
embedded software where was the necessity to invent a new
engineering methodology to overcome all facing problems and
obstacles. MBD (Model Based Design) is the new trend and has
been increasingly used and gaining popularity in the last years in
many industrial sectors (such as aircraft, automation and
automotive applications etc), due to the big set of benefits and
advantages it provides for both sides manufacturers and end
consumers. Some of the benefits are listed in the following [1]:
Reduced time to market (faster development)
Detection and elimination of software bugs and errors in
early development stages (quality improvement)
Producing superior quality products at lower cost
Flexibility concerning updates and last minute changes
The model-based design paradigm is significantly different
from conventional design methodology. The central component
or starting point of a model based developed application is a
system model (simulation model), where designers or
developers model the control algorithm or functional
characteristics of the intended application as interconnected
function blocks provided by the library of the used modelling
tool, e.g. Simulink
Matlab
/Simulink
.
4. HiL Test Bench- Idea and Building Procedures
4.1. Main Idea behind this Work
In the scope of a project that intends to develop a tool that
translates Simulink
for
the HIMA PLC series (HIMax, HIMatrix) using RTW
Embedded Coder, in order to enable the development of control
algorithms (e.g. a PID controller), since realizing this kind of
complex tasks with the standardized IEC 61131-3 Function
Block Diagram (FBD) PLC programming language is limited,
due to the poor set of blocks provided by the library defined in
this standard.
The tool described in the context of this work is concerned
with performing real-time Hardware-in-the-Loop simulation and
defines one of the last steps of the MBD life cycle. This step
consists of testing and validating the functionality of the auto-
generated code during real-time deployment on a HIMA PLC
system.
Since Simulink
supports this
communication standard through its promising OPC Toolbox.
4.2. HiL Test Bench Building Procedure
A. Simulink
Side
As mentioned previously the HiL test bench is a Simulink
Side
After a specific application has been implemented in
embedded C- code using the automatic code generator a
function block (so called CIF- C Interface Function block type)
has to be created manually in the SILworX environment. The
input and output pins of this block will be imported from a file,
which is supposed to be generated automatically during code
model conversion. Furthermore this block will be attached to the
auto-generated code also through its import option.
It should be also noticed that during code generation a file
with global variables will be generated. The global variables
become the same names as the inport and outport blocks of the
main model and two additional control global variables are
declared: EnableIn and EnableOut. These global variables are
used for data interchange with the OPC DA server.
Auto-created Simulink
HIL testing model
Simulink designed
model
Fig. 3. Auto generation of Simulink
model
The EnableOut variable is not that important, since the
EnableIn variable is controlled from the software that has been
attached to the Level-2 Matlab S-Function block and is used as
a control signal to activate and disable the CIF block. The
EnableIn and EnableOut will be connected to the EN input pin
and ENO output pin, which appear automatically when the user
chooses the option Show EN/ENO from the context menu of
the CIF function block in the program. The HiL test
environment in SILworX
side
C. How does it function
After having finished configuring an X-OPC DA interface
for the built SILworX
. To get a
better overview how the data transfer of the whole arrangement
works, take a look at Fig. 5.
During simulation or runtime the Level-2 Matlab S-
Function implemented in the Simulink
model) or the
values of the OPC readable items determined by the server
through read access will be given to the approriate outputs in
the Simulink
and SILworX
/Simulink
because in
the recent version the biggest part of configurations and actions
on SILworX