You are on page 1of 4

True Time based Simulation for wireless sensor

network

Chang Chen
1
, Zhenping Li
2
, Ping Song
1
* and Kejie Li
1

1
School of Mechatronical Engineering
Beijing Institute of Technology
Beijing,China
sping2002@bit.edu.cn
2
1
st
Department
China North Vehicle Research Institute
Beijing, China


AbstractComputer simulation is an essential procedure for
wireless sensor network design and optimize. After analyzing
some existing simulators, we proposed using True Time as WSNs
simulation tools, which is a MATLAB/Simulink based co-
simulation tools. It could not only simulate network behavior, but
also simulate in-node behavior and display the sampled signal
characteristic to end user. Then we give 8 nodes simulation and
discussed the basic simulation procedure. The simulation result
shows True Time could accomplish WSNs simulation.
Keywords-True Time; Wireless Sensor Network; Simulation;
I. INTRODUCTION
The emergence of wireless sensor networks (WSNs)
provide an efficiency and economical solution for distribute
applications. Each sensor node in a given WSNs is constrained
with the process capability, communication bandwidth, power
and storage, but when coordinated with the information from
other nodes, they could accomplish complex functions.
Consequently, for the purpose of improving efficiency and
economical, optimize a wireless sensor network is also an
important issues. Generally speaking, analyzing method,
computer simulation and physical experiment are the three
main techniques for wireless sensor network performance
analyzing.
However, analyzing method could not solve multi-
constrain large scale network problem. Physical experiment is
not an economical solution for repeat parameters optimize and
spatially deployment, its usually used for final verify.
Therefore, computer simulation is an essential procedure for
network design and optimize.
There are several simulators used for sensor network
research, such as NS-2, OMNET++, OPNET and TOSSIM.
NS-2 is a very popular general purpose discrete even
simulation tool for sensor network. Many extensions for WSN
are implemented in NS-2[1], like radio energy model, etc.
Nevertheless, NS-2 does not have a unified architecture.
Moreover, the reconfigurability of NS-2 components is a little
weak. OMNET++[2][3] is an open source component-based
discrete event network simulator. It uses C++ for simulation
model, mainly used for communication protocol, multi-
processor network or distributes system modeling and
simulation. OPNET [4] is a discrete event, object oriented,
general purpose network simulator. It provides supporting for
Zigbee compatible 802.15.4 MAC. A weak point is that there
are less ready models for recent wireless systems. TOSSIM [5]
is a simulator in TinyOS, which is a specially developed OS for
wireless embedded sensor network. We have used this tool to
provide some theoretical evidence for a wireless sensor
measurement system [6]. However, is need the support of
TinyOS and Nesc, can not used for general purpose
application.
All these simulators are focus on protocol or lower level
development. However, as an end user of Zigbee, we mainly
focus on the application level performance. For example, we
not only concern the PRR (package reception rate) of the whole
network, but also concern the sampled signal integrity and
microcontroller interruption frequency of a specified sensor
node, which could provide some theoretical evidence for later
work. Therefore, we introduced a new simulation tool for this
application, which is based on True Time [7].
The rest of this paper is organized as follows. Section II
introduced the True Time Kernel. Section III described the
mathematic model. Section IV gives the implementation
details. Section V shows the simulation result. The conclusion
is drawn in Section VI.
II. TRUE TIME BLOCKS
True Time (TT) is a MATLAB/Simulink based co-
simulation tools developed by Lund University, Sweden [8]. It
provides a simulation environment for network control and
sensor network. A unique characteristic is that True Time could
simultaneously simulate the computations within nodes, the
power consumption of node batteries, the node dynamic
changing (node communication range in specific transmission
power, package sending or receiving, network congestion,
package reception rate, etc.).
True Time provide a group of Simulink based block library,
which could be seen in Figure 1.
All of the blocks are implemented as variable-step S-
functions written in C++. Each block contains a discrete-event
simulator. Two important library blocks named True Time
Kernel and True Time Wireless Network are repetitious used
for sensor network simulation. The former block simulate the
event-based real-time kernel executing tasks and interrupt
handlers. The later block simulates local-area communication
Corresponding Author: Ping Song
978-1-4244-5392-4/10/$26.00 2010 IEEE
protocol and networks. For the purpose of distribute simulation,
each True Time Kernel controls its own event queen instead of
global timing. Task, interrupt handlers and timers are
represented by objects that are moved between various queues.
The true time wireless network message transmitting scheme
could be described as follows. The node first checks whether
the medium is idle. If that has been the case for 50us, then the
transmission may proceed. If not, the node will wait for a
random back-off time before the next attempt. The signal to
interference ratio in the receiving node is calculated by treating
all simultaneous transmissions as additive noise.[8]

Figure 1. True Time 1.5 block library
The internal structures are shown in Figure 2(a) and Figure
2(b). All the S-functions could be seen in source code
directory.

Figure2. (a) Internal structure of True Time Kernel

Figure 2. (b) Internal structure of True Time Wireless
network
III. SIMULATION MODEL
A typical wireless sensor network system is demonstrated
in Figure 3. Sensor nodes in monitor area corporately capture
target signals and transmit the message to sink node as route
protocol define. Most of the times, the message route is multi-
hoped and self-organized. The sink node then process these
message and transmit them into a public net and display the
result to end user.

Figure 3. Wireless sensor network system structure
For sensor network simulation, a general simulation model
could be illustrated in Figure 4.
S
e
n
s
o
r
c
h
a
n
n
e
l
w
i
r
e
l
e
s
s
c
h
a
n
n
e
l

Figure 4. General simulation model for sensor netwrok
To establish the simulation environment, some basic
formula should be introduced.
The transmit power and receive signal sensitivity in True
Time wireless network are expressed as dbm. Nevertheless, the
power consumption should be expressed in W or mW.
therefore, some transform should be done.
The relationship of dbm and w is
) 1 / log( 10 #
mW signal
P dbm =
(1),
Where
signal
P is the signal power.
Therefore, the transmit power
transmit
P is
) 10 / (
10 001 . 0
dbm
P
transmit
P =
..(2)
Where
dbm
P
is the power displayed in dbm.
The receive signal sensitivity
y sensitivit
P is
) 10 / (
10 001 . 0
dbm
P
y sensitivit
P =
.(3)
Where
dbm
P is the power displayed in dbm.
The propagation model used in true time wireless
simulation is
transmit a y sensitivit
P
d
P
1
=
(5)
Where P is transmit power, d is the transmit distance in
meters, and a is a various parameter for different environment.
Therefore, the sensor node communication range is
a
y sensitivit transmit
P P d
1
)
/ ( =
, .(6)
Where a=3.5 for default environment. However, the
transmit range in physical environment is much lower than this
theoretical distance for the microwave absorbing of air and
environment.
Form the point view of system, each sensor network
topology could be abstracted into a non-looped connected
directed graph N= (V, E). V is the set of nodes. E is the set of
edges. In this graph, direct connection (i, j) between node i and
j could exist only when j is in is neighbor set Ni. The ultimate
aim is establish a tree. In this tree, sink node is the root and
other node could be leaves or interior-points. For a given route
protocol, our simulation problem could be described as
researching the leaves performance in a given tree.
IV. SENSOR NETWORK SIMULATE IMPLEMENTATION
The aim of our simulation is test the sampled signals
integrity and microcontroller interruption frequency in a given
sensor network. This work could provide some theoretical
evidence for later work, such as passive acoustic localization,
time synchronization.
The simulation procedure could be described as follows.
(a) Establish simulation model. These models include
simulation scenario, sensor node model, system model and
some parameter.
The simulation scenario could be described as follows. 8
sensor node deployed in a 600m*600m square area, which is
shown in Figure 5. The source nodes sampled signals and
transmit it into destination node (sink node). We want to test
the sampled signals integrity after wireless transmitting and the
sensor node microcontroller task interruption frequency. Here
we use AODV[9] (ad-hoc On-demand Distance Vector
Routing) protocol as route protocol to establish target message
transmitting tree, which is provided by True Time. Its a simple
distance-vector based route protocol.

Figure 5. A sensor node deploy scenario
The sensor node structure is illustrated in Figure 6. A sin
wave signal and constant signal are added to the True Time
Kernel as source signals. We use True Time Battery to monitor
the sensor node power. Some scopes are added to view the
parameters changing.

Figure 6. Sensor node structure
(b) Initialize system model
It is an m-file. This code segment is used to initialize the
system model, system function and loading parameter. This
code segment will be executed at first.
(c) Initialize sensor node
This code segment is used to initialize sensor node,
including establish interruption handle, register nodeID in
network. This code segment will be executed secondly.
(d) Implement the interruption and task.
These code segments are used to implement the interruption
or task which is established in (c). For example, a periodic task
named sending is created in (c) using ttCreatePeriodicTask(),
we should implement it here. These code segments will be
invoked periodically or at a certain time.
V. SIMULATION RESULT
In this section we show some simulation result by using the
former sections scenario.
We first set the 8 nodes in (-80,-80),(-100,-50),(-100,0),(-
50,-100),(0,-100),(10,10),(90,90) and (190,190). Node 1
transmits sampled data to node 7. The network type is set to
802.15.4. The transmit power is set to 2.5dbm, receive
sensitivity is set to -70dbm. Simulation time set to 20s, data
transmit period set to 0.008s.
The simulation result is shown as follow.
During the simulation, node 1 sent 2500 byte data.
However, node 7 received 2424 byte data. The data curve is
shown in Figure 7. The data losing not only changed the
signals length, but also changed the signal frequency. If this
data is used for analyzing target characteristic, it will show a
specious result to end user.

Figure 7.The comparison of sent and received signals
Figure 8 shows the interruption of network sensor node. We
could know that sensor node 1,3,6 is active at this time. That
means the routing is 1-3-6-7.

Figure 8. Sensor node interruption
Figure 9 shows the power consumption of node 1.

Figure 9. Power consumption of node 1
As a comparison, we set the data transmitting period to
0.016s. Node 1 sent 1250byte data to node7, while node 7
received 1249byte. The received and sent data curve is shown
in Fig 10. We could see that received data is nearly the same as
sent date.

Figure 10. Received and sent data curve.
We could see the power consumption is less than Fig 9.
That means, when lower the data transmitting period, the data
loss could be improved. However, that means when
transmitting a given length signal, the transmitting time will
longer. From this simulation we could see True Time not only
simulate the network behavior, but also simulate the in-node
behavior and signal characteristic. However, it is not suitable
for large scale simulation.
VI. CONCLUSION
In this paper, we use true time as a tool to accomplish
wireless sensor network simulation. After give some analyzing
of True Time and wireless sensor network simulation, we give
an example of simulation, which use 8 node deployed in
600m*600m areas. Then we give the simulation result. Finally
we draw the conclusion that True Time could not only simulate
network behavior, but also simulate the in-node behavior and
signal characteristic.
ACKNOWLEDGMENT
We would like to express our gratitude to all the colleagues
in our laboratory for their assistance.
REFERENCES
[1] The Network Simulator ns-2, Available from
http://www.isi.edu/nsnam/ns
[2] C. Mallanda, A. Suri, V. Kunchakarra, etc. , Simulating Wireless
Sensor Networks with OMNeT++IEEE computer,2005
[3] Omnest network simulation, Available
http://www.omnest.com/network-simulation.php
[4] Hammoodi, I.S.; Stewart, B.G.; Kocian, A.; McMeekin, S.G. A
Comprehensive Performance Study of OPNET Modeler for ZigBee
Wireless Sensor Networks. NGMAST 09, page 357-362 ,2009
[5] Philip Levis, Nelson Lee, Matt Welsh, and David Culler. TOSSIM:
accurate and scalable simulation of entire TinyOS applications. In
Proceedings of the 1st international conference on Embedded networked
sensor systems, pages 126137, 2003.
[6] Chang Chen, Ping Song and Kejie Li, R-Sensing: a Route Solution for
Wireless Sensor Measurement System. Octember, Beijing, MAPE2009
[7] http://www.control.lth.se/truetime
[8] Anton Cervin and Karl-Eric Arzen. True Time: Simulation tools for
performance analysis of real-time embedded systems. In Gabriela
Nicolescu, Pieter J. Mosterman (Eds.): Model-Based Design for
Embedded Systems, CRC Press, November 2009.
[9] C.E. Perkins and E.M. Royer. Ad-hoc on-demand distance vector
(AODV) routing. In Proceedings of the 2nd IEEE Workshop on Mobile
Computing Systems and Applications, 1999.

You might also like