Sunteți pe pagina 1din 13

Hardware-In-The-Loop Configuration

using Matlab/SIMULINK

By: Vimal Rau

Introduction
HILS is known as hardware-in-the-loop simulation testing
where uses interaction between hardware and software.
xPC Target is a real-time software environment from
MathWorks which runs on a separate workstation
xPC Target is used as part of the real-time control
system for the projects.
In real-time control systems, the act of reading sensors,
generating feedback, and changing the corresponding
control input is guaranteed within a set response time.

MATLAB/Simulink is used to create a model


of the control system to communicate with
real-time workstation.
Simulink compiles your model and uploads
it into the xPC Target workstation.
xPC runs the real-time model, which ships
data back to the HOST PC(laptop) while
reading inputs and issuing commands with
the Data Acquisition boards (Ex: IMC board,
NI board, MCC DAQ).

Installation
xPC installation is a one-time
process, after which you will have the
freedom to work on simulation and
control design on your laptop while
using the desktop to test hardware
implementation.

Equipments

Host PC (operate SIMULINK system)


Target PC (xPC real-time target station)
Ethernet cable
xPC Target Bootable Disc
Matlab Software 2009b and above (any other compatible software for xPC)
Microsoft Visual Studio 2010 (beyond this version)

Host PC compiler setup


In the MATLAB command window, type xpcexplr to
open the xPC Target Explorer. In the left panel, under
Host PC Root > Compiler Configuration, make sure
VisualC is selected as the compiler and the path.

xPC Bootable Disc


Bring up xPC Explorer, under xPC Target Hierarchy you will see
TargetPC1 (if no target is present go to File>Add Target). Look for
Configuration > Communication, to the right will a window labeled
Target PC1 Communication Component at the top. Set the dropdown menus as and go for configuration to create BootCD:

xPC Target workstation


setup
The following steps have already been completed
on each workstation. Please do not alter the setup
in any manner.
(a) Installation of the DAQ card.
(b) Installation of xPC compatible Ethernet
card.
(c) Internal Network Interface Card (NIC)
disabled (if another Ethernet card installed).
(d) Boot sequence changed with CD ROM
priority

Configuration of Host PC
LAN
Go to Control Panel > Network and Internet >
Network and Sharing Center > Manage network
connections (for Vista) or Change adapter
settings
(Windows 7).
Select Local Area Connection > Properties.
Go to TCP/IP v4 Properties.
Select Use the following IP address and click
Advanced without filling in the details.
Set IP address to 192.168.1.1
Set the subnet to 255.255.255.0

xPC Workstation LAN Setup


In the MATLAB command window, type xpcexplr to
open the xPC Target Explorer
Under TargetPC1 > Configuration > Communication,
make the following changes :
(a) Select TCP/IP as the communication protocol.
(b)Set the Target TCP/IP address to 192.168.1.2
(c) Set the LAN Subnet Mask to 255.255.255.0
Select Apply.
Go to Target > Connect to Target to connect. Successful
connection is confirmed by checking TargetPC1. The
Connected status should be Yes.

Testing Procedure
Create a mdl file in SIMULINK to
interlink Host PC and Target PC using
the analog input (for ex: PCI 6221
since this the NI DAQ board serial
name)
Build the system to Target PC by
clicking Control+B
The xPC Target compiled the system
and upload in Target PC.

Thank you..

S-ar putea să vă placă și