BlueHoc Simulator  
  BlueHoc Manual
  Email us

BlueHoc: Bluetooth Performance Evaluation Tool

BlueHoc Manual

BlueHoc simulator provides a Bluetooth extension for Network Simulator (ver 2.1b6). BlueHoc is available for download under IBM Public License (IPL) from IBM developerWorks . It requires ns-2.1b6 which can be obtained from Network Simulator site.


The BlueHoc simulation program implements basic features of Bluetooth baseband, Logical Link Control and Adaptation Protocol (L2CAP) and Link Manager Protocol (LMP) specifications [1]. This tutorial covers the following topics:

BlueHoc simulation model

About ns from ns-manual [2]:
Network simulator is an object oriented simulator written in C++, with an Otcl interpreter as a frontend. The simulator supports a class hierarchy in C++ (compiled hierarchy) and a similar class hierarchy within the OTcl interpreter (interpreted hierarchy)....there is a one to one correspondence between the two hierarchies. The root of this hierarchy is the class TclObject. ....Users create new simulator objects through the interpreter which are closely mirrored by a corresponding object in the compiled hierarchy.. There are other hierarchies in the C++ code and OTcl scripts which are not mirrored....
This section describes the structure of a Bluetooth node (Tcl class, BTNode) which is an aggregate object used to simulate a Bluetooth device in BlueHoc. The class and its procedures are defined in ~ns/tcl/lib/ns-btnode.tcl. The class is derived from the Node class in ns and inherits its members. The Bluetooth specific members are implemented in C++ and can be configured from the Tcl/Tk interface. The command to create a BTNode is:

set btnode [new BTNode <ip_addr> <bd_addr> <0 or 1> <x co-odinate> <y-coordinate>]

where bd_addr is the Bluetooth device address. Bluetooth addresses like Ethernet addresses are 48 bits, but in this simulation Bluetooth addresses are restricted to 32 bits. The second argument is 0 for creating a slave and 1 for creating a master. The x and y co-ordinates are specified in meters. Figure 1 shows the structure of a Bluetooth master node. The init procedure (constructor) for BTNode is given below.

Class BTNode -superclass Node

BTNode instproc init {ip_addr bd_addr master X_ Y_} {
eval $self next $ip_addr
$self instvar bthost_ l2cap_ tb_ lc_ sched_ lm_ classifier_

# this part is common to master and slave
# create Bluetooth host, L2CAP and Baseband Objects

set bthost_ [new BTHost]
set l2cap_ [new L2CAP]
set lm_ [new Baseband]

# set targets and members of BTHost, L2CAP and Baseband

if {$master == 1} {

# Configuration for master

# Instantiate and set up Deficit Round Robin based scheduler

set sched_ [new BT_DRR]
$sched_ set cycleTime_ 0.1

set down_dmux_ [new Classifier/BTAddr]
$lm_ up-target $sched_

for {set i 0} {$i < 7} {incr i} {
# create 7 instances of Leaky Bucket Filter, ARQ module, LMP module
set lc_($i) [new LinkController]
set lq_($i) [new LMP]
set tb_($i) [new LBF]

$sched_ install $i $lc_($i)

# set targets and members of LMP, LBF and ARQ module
} else {
# configure as slave
set lc_ [new LinkController]
set lq_ [new LMP]
$lq_ set master_ 0

# set targets and members of LMP and ARQ module

C++ classes added to ns

The following C++ classes have been added:
Baseband Implements basic features of Bluetooth baseband
BT_DRRScheduler Deficit Round Robin (DRR) based scheduler
LinkController Stop and wait ARQ
LBF Leaky bucket filter
LMP Implements some LMP commands
L2CAP Basic L2CAP functionality
BTHost Bluetooth host which is layered over L2CAP
BTClassifier Classifies packets based on active mode address

The definitions for Bluetooth specific headers and classes are in ~ns/bt-def.h and ~ns/bt-core.h. The above code segment shows the various objects created for master and slave nodes. Figure 1 shows a master node with the targets of these objects. The black arrows show the target settings and thus the flow of packets while blue arrows show callbacks which give the upper layer a permit to send a packet.

Figure 1: Structure of a Bluetooth node


BlueHoc is supported by India Research Lab
Apurva Kumar IBM Corporation