Sie sind auf Seite 1von 6

2012

2012 Ninth
Ninth International
International Conference
Conference on
on Information
Information Technology
Technology-- New
New Generations
Generations

Castalia Network Animator (CNA): A Visualization Tool for Castalia Wireless


Sensor Network Simulator

Adib Rastegarnia

Vahid Solouk

Dept of Information Technology Engineering


Urmia University of Technology
Urmia,IRAN
Adib.rastegarnia@comsoc.org

Dept of Electrical and Communication Engineering


Urmia University of Technology
Urmia,IRAN
vsolouk@ieee.org

easier debugging processes [5]. It also supports event time


graphs which represent protocol specific information such as
an advancing sequence number or message transmission. In
addition, in [3] a visualization and analysis tool has been
developed for NS-2 wireless simulation scenarios which is
useful for visualizing large-scale WSNs, a simple Wireless
Local Area Network (LAN), or a Mobile Ad-hoc Network
(MANET). Among the major capabilities drawn from
simulation results using the mentioned visualizer, we can
refer to validating the accuracy of mobility model, validating
new versions of NS-2, and analysis of simulation results. A
universal java based visualization tool (NetViewer) for
WSNs is presented in [4]. In contrast to the most of the
visualization tools which are restricted to specific
applications, this universal tool has been developed with the
capability of supporting any type of applications. In addition,
it has a friendly Graphical User Interface (GUI) and it can be
easily extended for specific applications by using modular
components [4]. The study in [8] reports a multi-view
communication visualization tool for wireless networks
simulation which was developed to provide three view types
including textual, map and graph views from the network.
Events in this visualizer are shown by the tool in textual
view similar to a text editor. To achieve better readability,
the authors used map view to demonstrate the current
positions of all nodes, and the graph view to show the
communication patterns in intra and inter node levels. The
proposed visualizer supports trace files pertaining to NS-2
and Shox simulators, while supporting other formats are
projected based on the modularity of tools architecture.
Furthermore, an NS-2 Visualization tool for mobility related
simulations named Extensible Animator (EXAMS) is
presented in [9]. This tool provides an environment through
which various scenarios of wireless network protocols can be
studied, debugged and tested. The proposed tool is
additionally capable of visualizing the internal data
structures of network protocols such as routing tables, state
variables etc.
In this paper, we propose a visualization tool designed
for Castalia wireless sensor network simulator called
Castalia Network Animator (CNA). CNA is an offline
visualization tool which visualizes the simulation scenarios
based on simulation results produced by Castalia simulator.
The rest of paper is organized as follows: the following
section provides an overview of Castalia wireless sensor

Abstract Castalia is among the specialized simulators that


researchers in the area of low power personal networks utilize
for various purposes. However, the lack of visualization tool
for any simulator causes the decrease of thorough studies
carried out. Aiming at further facilitating Castalia simulator,
the current study introduces a network visualizer, CNA,
which is designed and implemented for animating simulation
scenarios produced by Castalia. The proposed animator is
designed so that it performs all the operations necessary for
animating a simulated network. It includes several features
from supporting various trace files to software capabilities
which are outlined in details. The case studies prove the
precision and proper functioning of the proposed animator.
Keywords: Castalia simulator, Network animator,
Visualization tool, wireless sensor network simulator.

I.

INTRODUCTION

Wireless Sensor Networks (WSN) in general consist of


sensor nodes that are densely deployed over a geographical
area to perform special tasks such as environmental
measurements, target tracking, intrusion detection, climate
control, and so on. To ensure a wide range of applications,
sensor networks are equipped with some features [1, 2].
Over the recent years, WSNs have become a popular area
of research among researchers. Simulation study or an
experimental testbed implementation are used by researchers
to implement and analyze new methods and algorithms [3].
In addition, simulation-based studies are said to be more
desirable for the reasons such as cost of deploying a WSN in
a geographical area, ease of collecting results for simulation
vs. implementation, and more specifically, feasibility of
studies requiring scalability in either node or area concepts.
When simulating, the status of the network demonstrated by
visualization tools is rather helpful to gather more
information from sensor nodes and show them in graphical
form on screen [4]. Providing useful information quickly
such as the network topology of nodes and better
understanding of causality and interaction are only some
benefits of visualization tools [5]. Most popular simulators
such as NS-2 [6] and OMNET++ [7] include visualization
applications. For instance, network animator (NAM) is a
visualization tool which has been developed for NS-2
simulator. Packet level animation and scenario editing
capabilities are supported by the NAM which are useful for
978-0-7695-4654-4/12 $26.00 2012 IEEE
DOI 10.1109/ITNG.2012.15

48

between sensor nodes. By providing this feature in


CNA, users can monitor the transmission of packets
in each point of simulation time.
The visualizer should be able to provide a list of all
transmission events during simulation. By tracing
transmission events, users can validate the
simulation scenario.
Users should be able to pause and resume the
simulation in each point of running time. By
providing this feature in CNA users can monitor the
simulation events in each point of time.
In order to provide better view of node positions,
users should be able to zoom in and zoom out the
screen in CNA.
The design and implementation of the objectives of CNA
are outlined as the following:

network simulator. The design and implementation of the


proposed animator, CNA, is described in Section III. Section
IV presents some validation processes which are analyzed to
show how the animator performs. A comparison between
NS-2 animator, NAM, and CNA is presented in Section V.
Finally, Section VI concludes the paper.
II.

AN OVERVIEW OF CASTALIA WIRELESS SENSOR


NETWORK SIMULAOTR

Castalia is a simulation tool especially designed and


implemented for simulation of WSN, Body Area Networks
(BAN), and every network consisting low power devices.
Castalia was developed by the NICTA Ltd, Australias
Information and Communications Technology Research
Centre of Excellence. Castalia is based on OMNET++
simulator and researchers can implement and analyze their
algorithms using realistic wireless channels and radio models
before deploying them in real world scenarios [10]. Modules
and Messages are basic concepts of Castalia simulator. Each
module is defined as a basic unit of execution which
executes a piece of code based on messages that receive from
self-module or other modules.
The simulation results produced by Castalia are stored in
text file called trace file. Each record in the trace file
comprises a line with the following form:

B. Visualization of Sensor Nodes Deployment


The deployment of a WSN scenario is performed by
defining the network specifications in configuration file of
Castalia simulator. To collect the location information of
sensor nodes based on the deployed scenario, the feature
named collecting trace messages is enabled for mobility
manager module in configuration file.
The Input/Output (IO) methods for file operations such
as opening, reading, and so on are used to visualize sensor
nodes on their locations. The design and implementation of
the algorithm is outlined as the following:
1) Open the trace file and store all of the lines in an array
to use in future in all parts of the program.
2) To find the coordinates of sensor nodes the array is
parsed line by line. To parse the array some methods of
file functions such as Spilt and Substring are used. The
substrings in a string are delimited by one or more
characters and are identified by the Split method. In
addition, to retrieve a substring in this instance
Substring method is used.
3) Sensor nodes are drawn on screen by using drawing
methods provided in WPF technology. The shape class
of WPF provides numerous varieties of basic shapes.
The methods and shape objects are used for drawing
sensor nodes on screen.
To validate the implementation of visualizing WSN
deployments, two simulation scenarios are defined as
follows:
1) In the first simulation scenario, a number of 17 sensor
nodes are deployed in a field of 40 40 meters. The
sensor nodes are deployed randomly in the field. The
coordinates of sensor nodes are presented in Table I and
the deployment of sensor nodes in the mentioned
scenario which is visualized by CNA are illustrated in
Figure 1.
2) In the second simulation scenario, a number of 17
sensor nodes are deployed in a field of 40 40 meters.
In this scenario, 16 of the sensor nodes are deployed in
the grid form topology, while the sink node is located in

<simulation-timestamp> tab <module name producing


trace> tab <trace message>

(1)

Simulation-timestamp refers to the time in which an


event in one of the modules occurs. The parameter Module
name producing trace refers to the module that produces the
trace message pertaining to the event that happens in the
module. Simulation scenarios are defined in a configuration
file. Collecting and storing simulation results in the trace file
for each module is achieved by enabling a special feature for
collecting trace messages feature for each module in
configuration file.
III.

DESIGN AND IMPLEMENTATION OF CNA

Windows Presentation Foundation (WPF) technology in


Visual Studio 2010 is used for implementing CNA. WPF is a
subset of .Net Framework and is suitable for creating
interactive applications by using a powerful set of graphics
and layout features provided in WPF [11, 12]. The animation
capabilities of WPF facilitate animating controls and other
graphical objects without the need for creating own timing
system or using special custom libraries.
A. Considerations CNA Desgin
As the main requirements of developing CNA, the
following points are projected:
The visualizer should be able to visualize the
position of sensor nodes in graphical form on screen.
This feature provides an overall view of the network
topology.
The visualizer should be able to visualize the
transmission (sending and receiving) of the packets

49

messages. The first message indicates that sensor node #12 is


sending packet #7 at the time 2.606285317078 seconds with
the reference of simulation run.
In the second message, the sink node (#0) received the
packet number #208 from the sensor node #3 at the time
42.873216561434 seconds with the reference to simulation
run.

the center of the grid. The coordinates of the sensor


nodes are presented in Table I and the deployment of
sensor nodes in the grid topology visualized by CNA is
found in Figure 2.
ANALYSIS AND VALIDATION OF CNA

IV.

In order to validate the functionality and the precision of


the CNA operation in visualizing sensor networks, we tested
the proposed approach using two scenarios of WSN based on
the sensor deployment type, namely random and grid
deployments. As shown in Figures 5 and 6, the nodes are
drawn on the screen using surface charts. To visualize the
sensor nodes on each deployment, the coordinates of the
sensor nodes were extracted from the trace file and imported
into the data file of the surface chart. These coordination data
are listed in Table I. The resultant visualization of the both
scenarios using CNA can be seen in Figures 1 and 2. Based
on the coordination data, it can be said that each node is
shown in the exact location as determined through the initial
deployment of the scenario which evidences the proper
functioning of the deployed visualization.
TABLE I.

2.606285317078 SN .node[12]. Application Sending packet #7

(2)
42.873216561434 SN.node[0].Application Received packet #208 from node 3

In order to implement visualization of transmitted


packets between sensor nodes, the WPF classes, Dispatcher
timer and DoubleAnimation are used. For managing the
functioning items of a thread at a specific time interval and
priority, a special timer named Dispatcher timer is used. In
addition, animation capabilities in WPF are provided by
DoubleAnimation class. The designed and implemented
algorithm for visualization, the exchange of packets between
two sensor nodes is outlined as follows:
1) As the first step, in order to implement visualizing the
exchange of packets between two sensor nodes, two
types of events are considered in application module,
including sending packet and receiving packet events.
2) Each line stored in the array form in the trace file is
parsed to determine the type of events in the application
module. The string method Contain is used to check
the content of the trace message and determine the
receiving or sending events in the elements of the array.
Contain method is a case sensitive ordinal method that
indicates whether a specified string object occurs within
the string [11].
The events of sending and receiving packets are
visualized by a node blinking with different colors according
to each event. Thus, while nodes blinking in red color
indicate that the nodes are in the packet sending event,
blinking blue color is used for a node in packet receiving
events as illustrated in Figures 1, 2, 3 and 4 for the both
simulation scenarios.
As the second step of the animator validation, we intend
to analyze the visualization of packets transmission in CNA.
We used the number of transmitted and received packets by
specific nodes within the scenario of random deployment
over a certain period of time and then compared them with
those resulted from CNA during visualization of packets
transmission. As illustrated in Figure 1, the number of
transmitted packets at the time 2.606285317078 seconds are
equal to 8 (as the counting reference, the sequence number of
packets started from 0) for the sensor node #12 in random
deployment scenario which is identical to the simulation
results shown in Figure 7. Furthermore, Figure 3 also shows
that when the packet #163 was sent from the node #2 to the
sink node at the time 33.877950272329 seconds, an overall
of 164 packets was received successfully by the sink node
from the node #2. This is also shown in Figure 8.

SENSOR NODES COORDINATION IN SIMULATION


SCENARIOS

Node
ID

Grid Deployment

Random Deployment

X
Coordination

Y
Coordination

X
Coordination

Y
Coordination

20

20

21.9525

23.7138

33.7706

24.1105

13

21.7953

33.8901

26

24.9425

25.8358

39

17.5035

11.9014

13

2.26852

38.5465

13

13

15.3377

19.1066

26

13

32.4867

21.1558

39

13

22.7218

15.7114

26

33.4432

2.84144

10

13

26

3.48517

25.9269

11

26

26

14.7297

33.3048

12

39

26

31.1263

5.61403

13

39

34.8035

39.1447

14

13

39

31.9663

32.0364

15

26

39

20.8191

31.2212

16

39

39

4.73098

28.8253

A. Visualizing Packets Transmission between Sensor


Nodes
To collect and store reports of transmission packets
between sensor nodes in the trace file, the feature of
collecting trace messages in the application module for each
simulation scenario is enabled in the configuration file.
Packets which are transmitted or received by the sensor
nodes in the application module are reported in the trace file.
Equation 2 represents two types of application module trace

50

Figure 1. Visualization of Random deployment scenario and sending


packets in CNA

Figure 3. Visualization of receiving packets by the sink node in


random deployment scenario

Figure 2. Visualization of Grid Deployment Scenario and sending


packets in CNA

Figure 4. Visualization of receiving packets by the sink node in grid


deployment scenario

B. Visualize List of Transmission Events


In some cases the users need to trace the transmission
events occurred during the simulation time to validate the
simulation scenario. In order to satisfy this requirement, a list
of sending and receiving transmission events is provided in
the CNA. This list is dynamically updated as the simulation
time elapses. An example of this event is illustrated in Figure
1 using an orange bold-lined rectangle.

In order to implement this feature, the messages from the


trace file are retrieved line by line for being illustrated in a
list box during the simulation.
C. Simulation Pause and Resume Features in CNA
The implementation of the features for suspending and
resuming an ongoing animation is also deployed in the CNA
tool. The projection for these features is to give user the
capabilities of suspending the animation at specific

51

simulation times in order to evaluate the events more


precisely. These features also facilitate users to observe
which packet be sent or received by which nodes. The
obtainable information can be found in the status bar which
is designed to include the simulation time, the type of
transmission events (sending or receiving) as well as the
number of packets.
The whole message of the status bar is highlighted by a
red bold rectangle in Figure 1. In order to implement this
feature; the DispatcherTimer class in .NET framework is
used. The designed and implemented algorithm for pausing
and resuming the simulation scenario is outlined as follows:
1) By disabling dispatcher timer in pause button event,
the simulation scenario is stopped at that simulation
time until being re-enabled.
2) By enabling dispatcher timer in resume button event,
the simulation scenario is resumed from the time
which was paused before.

D. Zoom Feature
This feature is implemented to provide better view of the
sensor nodes deployment and to fit the whole network
components in the observable area of the screen. To
implement the zoom feature, the slider class is used. It is a
control that lets the user select from a range of values by
moving a Thumb control along a Track. Two different views
(zoom in and zoom out) of grid deployment by using zoom
slider illustrated in Figures 9 and 10.
V.

Some of the main features of NS-2s network animator


(NAM) are compared with the main features of CNA and
the results of our comparisons are illustrated in Table II.

Figure 5. The surface chart of Grid deployment scenario

Figure 7. Number of transmitted packets for node 12 vs. simulation


time in random deployment scenario

COMPARSION WITH NS-2S NETWORK ANIMAOTR


(NAM)

Figure 6. The surface chart of random deployment scenario

Figure 8. Number of received packets by the sink node from node 2


vs. simulation time in random deployment scenario

52

VI.

CONCLUSION

TABLE II.

COMPARISION BETWEEN THE NAM AND CNA


VISUALIZATION TOOLS

The capabilities of Castalia simulator in aiding


researchers carry out studies in various aspects of low power
WPAN networks from the initial deployment design to
detailed and specific performance analyses has raised the
needs for a visualizer for this useful tool. The current paper
outlined a study on design and implementation of a
visualizing tool for Castalia wireless sensor network
simulator. After providing a brief review on the simulator,
the details of the initial design was presented. Then the
precision of the animator together with the implemented
features were introduced and analyzed based on two
deployment scenarios of WSN. The proposed animator is
projected to release as stand-alone software which can be
used beside Castalia and in parallel mode with the simulation
processes. The authors hope that CNA contribute in WPAN
research and study thrives.

Features

NAM

CNA

Visualization of network topology

Visualization of packets transmission

Visualizing list of transmission events

Zoom, pause and resume features

Scenario creating and editing

Visuliazation of routing Information

REFERENCES
G. Anastasi, et al., "Energy conservation in wireless sensor networks:
A survey," Ad Hoc Networks, vol. 7, pp. 537-568, 2009.
[2] K. Kredo Ii and P. Mohapatra, "Medium access control in wireless
sensor networks," Computer Networks, vol. 51, pp. 961-994, 2007.
[3] S. Kurkowski, et al., "A visualization and analysis tool for NS-2
wireless simulations: iNSpect," in Modeling, Analysis, and
Simulation of Computer and Telecommunication Systems, 2005. 13th
IEEE International Symposium on, 2005, pp. 503-506.
[4] M. Longhui, et al., "NetViewer: A Universal Visualization Tool for
Wireless Sensor Networks," in GLOBECOM 2010, 2010 IEEE
Global Telecommunications Conference, 2010, pp. 1-5.
[5] D. Estrin, et al., "Network visualization with Nam, the VINT network
animator," Computer, vol. 33, pp. 63-68, 2000.
[6] (2011).
The
Network
Simulator
ns-2.
Available:
http://isi.edu/nsnam/ns/
[7] M. Liebsch, et al. (2005). Candidate Access Router Discovery
(CARD). Available: http://www.ietf.org/rfc/rfc4066.txt?number=4066
[8] P. Janacik, et al., "Multi-view Communication Visualization for
Wireless Network Simulations," in Intelligent Systems, Modelling and
Simulation (ISMS), 2010 International Conference on, 2010, pp. 181186.
[9] L. S. Nikolaos, "EXtensible animator for mobile simulations:
EXAMS," in Modeling, Analysis & Simulation of Computer and
Telecommunication Systems, 2009. MASCOTS '09. IEEE
International Symposium on, 2009, pp. 1-3.
[10] A. Boulis, Castalia: User's manual, 2011.
[11] (2011).
WPF
Microsoft
User
Guideline.
Available:
http://msdn.microsoft.com
[12] C. Andrade, et al., Professional WPF Programming: .NET
Development with the Windows Presentation Foundation: Wrox,
2007.
[1]

Figure 9. A Zoomed-in scene of the deployment

Figure 10. A Zoomed-out view of the simulation

53

Das könnte Ihnen auch gefallen