Cluster Attack
Cluster Attack
Sensor networks consist of a large number of small independent devices. Each device, called
a sensor node, is battery powered and equipped with integrated sensors, data processing, and
short-range radio communication capabilities. A significant amount of research has been done
in the area of connecting large numbers of these sensors to create robust and scalable
Wireless Sensor Networks (WSNs). Although individual sensor nodes have limited
capabilities, WSNs aim to be energy efficient, self-organizing, scalable, and robust. A
substantial amount of research has cantered on meeting these challenges.
The large deployment of WSNs and the need for energy efficient strategy necessitate efficient
organization of the network topology for the purpose of balancing the load and prolonging
the network lifetime. Clustering has been proven to provide the required scalability and
prolong the network lifetime. Due to the bottle neck phenomena in WSNs, a sensor network
loses its connectivity with the base station and the remaining energy resources of the
functioning nodes are wasted.
This project aims to implement a clustering scenario and analyze the effects of increase in the
number of nodes in the cluster on the energy of Cluster Head (CH). The sensor nodes are free
to move from one cluster to another. The project further aims to implement an energy
efficient dynamic algorithm which re-elects the CH after a specific period of time hence,
saving energy. We also compare the efficiency of this algorithm by analyzing the graphs of
energy levels of the CH during the lifetime of the netwo
ii
CHAPTER 1
INTRODUCTION
CHAPTER 1
INTRODUCTION
The field of Wireless Sensor Networks may be in an infant stage but has a made great
progress over the years. WSN is a network of sensor nodes deployed over a wide area. The
sensor nodes are micro computers having the ability of sensing data, capturing, processing
and transmit it to the sink or main base station of the information. Sensor node is made of
five main components namely, sensing unit, processing unit, memory, transceiver and power
management unit.
The sensing unit captures the required data, passes it to the processing unit which aggregates
together different data and stores it in packets. After timely duration it is transmitted over to
the sink from where the user can access the data of various WSN.
A sensor node has many limitations. A sensor node has limited power since it has a small
battery as power source. If it dies out, it has to be replaced with new sensor nodes. It has
limited computation capability due to which it cannot be loaded with huge computation
problems. Although the sensor nodes individually have limited capabilities, their
collaboration to perform a specific task produces an enhanced view of the physical world. It
is widely used because of its robust nature, easy deployment in remote places and retrieval of
variety of information which is helpful in applications.
Most applications fall into one of four classes: environmental data collection, security
monitoring, node tracking, and hybrid networks. The different applications are target field
imaging, intrusion detection, weather monitoring, security and tactical surveillance;
distributed computing; the detection of ambient conditions such as temperature, movement,
sound, and light or the presence of specific objects, inventory control, and disaster
management.
1.2 APPLICATION
The applications for WSNs are many and varied. They are used in commercial and industrial
applications to monitor data that would be difficult or expensive to monitor using wired
sensors. They could be deployed in wilderness areas, where they would remain for many
years (monitoring some environmental variable) without the need to recharge / replace their
power supplies.
Typical applications of WSNs include monitoring, tracking, and controlling. Some of the
specific applications are habitat monitoring, object tracking, nuclear reactor controlling, fire
detection, traffic monitoring, etc. In a typical application, a WSN is scattered in a region
where it is meant to collect data through its sensor nodes.
In WSN, the limited capabilities (battery power, transmission range, processing hardware and
memory used, etc.) of the sensor nodes combined with the special location-based conditions
met (not easily accessed in order recharge the batteries or replace the entire sensors) make the
energy efficiency and the scalability factors even more crucial. Moreover, the challenge of
prolonging network lifetime under the above restrictions is difficult to be met by using only
traditional techniques.
Dynamic Network Topology: The variability of network topologies due to node
failures, introduction of additional nodes, variations in sensor location and changes to
cluster allocations in response to network demands requires the adaptability of
underlying network structures and operations.
Resource Limitations: Battery power, memory, processing power and lifetime are
physical constraints that impact every aspect of WSNs.
Failure Prone: Individual sensors are unreliable in harsh and unpredictable
environments.
Network congestion resulting from dense network deployment: The quantity of
data gathered may exceed the requirements of the network and so evaluation of the
data and transmission of only relevant and adequate information needs to be
performed.
The WSNs with high performance will come into practice if the following requirements are
satisfied
In the first chapter, a brief description about WSN is provided. In the initial phase of the
chapter, detail description of WSN is given which tells about what it is, its limitations and
advantages. Then the report continues about the applications of WSN in various field and
then proceeds to describing the challenges faced in deploying it.
The second chapter talks about routing and clustering protocols in detail and along with that
discusses about the addressing schemes. The third chapter talks about the problem statement
and various aspects related to it.
Fourth, fifth and sixth chapters tells about the different life cycles through which the project
passes like the planning, analysis and designing. An assortment of UML diagrams help in
understanding the project better.
Seventh chapter briefs more about NS-2 commands and codes utilized to implement the
project and how it leads to various outputs.
Eight chapter describes different scenarios so analysis can be made from the results with are
obtained from the simulation. It has different graphs which help understanding the results
through graphical visualization of results.
Inference obtained and how the project can be expanded is described in the latter chapters.
CHAPTER 2
BACKGROUND AND
LITERATURE
SURVEY
CHAPTER 2
BACKGROUND AND LITERATURE SURVEY
2.1 CLUSTERING
Clustering is the process of dividing a WSN into groups or sub parts. The main purpose of
dividing a WSN into clusters is to increase its scalability, robustness, high- efficiency and
moreover to increase its power consumption. A cluster also increases the efficiency by
managing the communication bandwidth by reusing it. There are various objectives of cluster
systems that distinguish them from others, such as load balancing, fault tolerance, increase in
connectivity, and maximize longevity. Thus, clustering is a good technique for longer
network life and efficient management of resources.
There are 2 types of communications that take place in a typical clustered system:-
Various clustering algorithms are used for implementing clustering in a WSN, namely:-
Protocol designers have started developing energy efficient routing protocols for WSN
because of the energy constraints of the sensor nodes. Protocols are designed by using
shortest paths between nodes, clustered environment with hierarchical routing between nodes
that are helpful in conserving energy in WSN. Single hop communication between nodes,
network congestion due to the large number of sensor nodes under one cluster are some of the
bottleneck’s for the energy efficiency in the WSN. There are some existing routing protocols
that can be compared for analysis.
Focus is put on how AODV protocol work and its suitability for different network and
mobility conditions, as this is important for its deployment in a WSN.
Ad hoc On-demand Distance Vector (AODV)
AODV is a stateless on-demand routing protocol. It is classified under reactive protocols. The
operation of the protocol is divided in two functions, route discovery and route maintenance.
In Ad-hoc routing, when a route is needed to some destination, the protocol starts route
discovery. Then the source node sends route request message to its neighbors. And if those
nodes do not have any information about the destination node, they will send the message to
all its neighbors and so on. And if any neighbor node has the information about the
destination node, the node sends route reply message to the route request message initiator.
On the basis of this process a path is recorded in the intermediate nodes. This path identifies
the route and is called the reverse path. Since each node forwards route request message to all
of its neighbors, more than one copy of the original route request message can arrive at a
node. A unique id is assigned, when a route request message is created. When a node
received, it will check this id and the address of the initiator and discarded the message if it
had already processed that request. Node that has information about the path to the
destination sends route reply
message to the neighbor from which it has received route
request message. This neighbor does the same. Due to the reverse path it can be possible.
Then the route reply message travels back using reverse path. When a route reply message
reaches the initiator the route is ready and the initiator can start sending data packets.
The advantage of AODV is that it utilizes destination sequence numbers to ensure loop-
freedom at all times and to avoid the count-to-infinity problem associated with classical
distance-vector protocols. It offers low overhead, quick adaptation to dynamic link conditions
and low processing and memory overhead.
In routing technologies, the addressing structure and the naming system of networks the
fundamental components used to denote and find end users or messages in networking.
Addresses can be either bound with hardware during the manufacturing process (MAC) or
assigned on demand by addressing protocols(IP).The on-demand addressing protocols can be
further sorted into centralized and distributed. The first one employs a central addressing
coordinator and the latter one does not respectively.
Addressing deals with assignment of ID to sensor nodes in the network so that sensors can
build a functional communication paradigm. Due to special data reporting behaviour of
sensor nodes in the network and other physical constraints, address assignment problem for
sensor network is significantly different from that of for tradition network. There are
currently two types of distributed addressing schemes, flat and hierarchical.
Flat Addressing: The majority of MANET routing protocols employ a flat addressing
mechanism. In a flat network, addresses are randomly assigned to nodes; therefore, the
distribution of addresses is unrelated to the network topology. Although the addressing
process is easy, a flat address structure always makes it hard to build a path between two
arbitrary nodes.
The WSN as a research domain is gaining importance today because of its low cost, mobile
nature, small size and its applications in remote area. The literature review is focused over the
papers published during the year 2006-2011 in IEEE journal, proceedings and international
conferences. The papers are focusing mainly on WSN architecture, clustering and energy
efficient protocols. These papers primarily study the above mentioned aspects of WSN and
lay down proposed guideline for a better performing WSN. Some of these are elaborated
below.
Few Indian authors point out that Energy efficient grid based topology and Cluster Head
election based on energy increase the overall life of the network drastically [7]. Mr. Enamul
Haque in his thesis compares LEACH, CACH and CAMHP in all aspects. Comparison shows
reduced data traffic in CACH compared with LEACH, which ensures more idle time and
longevity of the network. Performance evaluation of CAMHP shows significant energy
efficiency compared to LEACH and Multi-Hop model. As a whole, techniques applied in
CAMHP performs efficiently in energy saving and the network provides a longer full-scale
active service. [9].
Mr Muattaz Elaneizi in his thesis conclude that transmission tuning algorithm for cluster-
based WSNs balance the load among cluster heads that fall in different regions. This
algorithm is applied prior to a cluster algorithm to improve the performance of the clustering
algorithm without affecting the performance of individual sensor nodes. As a result, the
network lifetime has been prolonged. But they also point out that this algorithm is suited only
for static WSN [8]. Another Author shows us the energy consumption for some algorithms in
WSN. He proposes a dynamic routing protocol based on probability to reduce the energy
consumption of the nodes. Here, the information is routed through the node with the highest
energy. But mobility of nodes hampers the routing protocol [11].
CHAPTER 3
PROBLEM
STATEMENT
CHAPTER 3
PROBLEM STATEMENT
The system is designed such that different scenarios of routing within a WSN can be analyzed
in such a way that their energy efficiency can be increased. The different effects of changes in
parameters of the scenario where nodes are moving within and in between clusters are
observed to increase their life.
PROJECT PLANNING
CHAPTER 4
PROJECT PLANNING
Operating System:
1. LINUX Ubuntu 10.04.
“Dynamic routing of
4 Packets in WSN” as a 22/07/2011 22/07/2011 1
project.
Collecting required
9 28/07/2011 06/08/2011 10
documents
Documentation and
12 11/09/2011 3/10/2011 23
designing
Implementation of grid
22 15/01/2012 19/01/2012 5
based clustering algorithm
Implementation of energy
24 25/01/2012 31/01/2012 7
efficient election algorithm
WSN
Collect data]
Generate
Performance graph Base Station
Communicate to
wired
connection
Sense data
Transfer to
Custer
Head Transfer data to
BS
«include»
Acting as CH
«include»
Aggregate Data
3. BS: BS will collect the data from all the CHs and forward it to a wired station. It also
performs necessary tasks in cluster formation and CH re-election on request of
Network Architect.
5.1.2 CH Re-election
uc cluster
Cluster
Sense
data
Report energy
level
to BS Fwd node info to
NA
Report Position to
BS Assign CH Base Station
Sensor Node
CH notification
Act as to Request position &
«include»
CH nodes energy from nodes
«include»
Receive CH
assignment
Request energy
and
position
Network
Arthitect
CH election
Distance
based
CH re-election
Energy
based
Assign CH
1. Network Architect: The network architect requests for energy and position data to
the BS, on receiving the positional parameters, the node with the lowest distance from
the BS is taken into consideration and CH privileges are assigned to it.
2. BS: According to the Network Architects request, the BS will request a node to
forward its Positional and energy data. On receiving the energy and position
information the BS will forward it to the Network Architect. A notification in
correspondence to the CH assignment will be received by the BS from the NA and the
BS will assign a node as a CH.
3. Sensor Node: Sensor node on receiving the request from the BS, the sensor node will
report its energy levels and position to the BS. The BS assigns a sensor node as a CH,
and then the sensor node will notify other nodes of its assignment.
5.2 SEQUENCE DIAGRAM
Get_node_posn
Req_posn
Return_pos
Return_pos
Get_energy_
info
Get_energy
Get_Energy(node_id)
Return
Return
Reurn
Distance_based_CH_reelection
Assign_CH
CH_Notification
CH_Notification
Energy_based_CH_reelection
Assign_CH
CH_Notification
CH_Notification
1. The Network Architect requests for node position and energy levels from the BS.
2. The BS requests position and energy levels from the sensor nodes.
3. The sensor nodes returns its position and energy to the BS and the BS returns it to the
network architect
4. The network architect runs distance based and energy based CH re-election algorithm.
5. It assigns a CH amongst the sensor nodes in a cluster based on the Distance based or
energy based CH re-election algorithm and notifies it to the BS.
6. The BS notifies the sensor node about the CH assignment.
7. The CH notifies other nodes in a cluster about the CH assignment.
CHAPTER 6
PROJECT DESIGN
CHAPTER 6
PROJECT DESIGN
Base_Station
Network_Arch
- BS_Corod: int
- BS_ID: int - Arch_Id: int
- Node_Coord: int - Arch_name: char
1.. 1
+ Design_nw();() : void
+ Collect_data() : void
+ Ini_relection() : void
+ Conn_Wired() : void
+ Manage_nw()() : void
+ Trans_Data() : void
Cluster_Head
- Cluster_no: int Sensor_Node
- Node_Coordinate: int
- Node_Coordinate: int
- Node_Energy: int
- Node_Energy: int
- Node_Id: int
- Node_Id: int
1 *
+ Agg_Data() : void
+ Collect_Data() : void + Get_cid() : void
+ Fwd_Data() : void + Get_energy() : void
+ Get_Energy() : void + Get_movcord() : void
+ Get_Movcord() : void + Send_data() : void
Start
Sense Data
[NO]
Aggerate Data If CH Route Data To Cluster
[YES]
Head
To setup and run a simulation, a user writes an OTcl script, which is a simulation program to
initiate an event scheduler, set up the network topology using the network objects and
plumbing functions in the
library, and to tell traffic sources when to start and stop
transmitting packets through the event scheduler. When NS-2 which works as OTcl
interpreter receives the OTcl script, it will set environment parameters following the received
script. If a user wants to make a new network object, it will be easy to make a compound
object from the object library, and plumb the data path through the object rather than write a
new one. When the simulation is finished, the simulation results are produced in one or more
text-based output files known as “trace files” that contain detailed simulation data, which can
be used to analyze results of simulation into a trace graph directly or can be used in the
graphical user interface. NS is extended by supportive utilities like Network Animator
(NAM) and Xgraph:
Nam is a Tcl/TK based animation tool or a graphical interpreter for visualizing network
simulation traces and real world packet traces. It supports topology layout, packet level
animation, and various data inspection tools.
7.1.3 Xgraph
wireless.tcl
#======================================================================
# Define options
#======================================================================
#Create Topology
# Configure nodes
#Create 2 nodes
# Create Movement
56. $ns at 50.0 "$n1 setdest 25.0 20.0 15.0" # Node (1) starts to move towards node (0)
57. $ns at 10.0 "$n0 setdest 20.0 18.0 1.0"
58. $ns at 100.0 "$n1 setdest 490.0 480.0 15.0" # Node (1) starts to move away from node (0)
set ns [new Simulator] generates a new NS simulator object instance, and assigns it to a
variable ns. This line creates an event scheduler for the simulation, initializes the packet
format and selects the default address format.
$ns namtrace-all nf tells the simulator to record simulation traces in NAM input format.
nf is the file name that the trace will be written to later by the command $ns flush-trace.
$ns trace-all $tf tells the simulator to tarce the activities at the agent, router and MAC
level. This command by default starts tracing the Queue. tf is the file name that the trace
will be written to later by the command $ns flush-trace.
proc finish {} closes the trace file filters the trace file with the help of an awk script into
another trace file containing values for X and Y-axis which are used to show the
simulation results on the X-Graph . It also starts the NAM.
create-god $val(nn) stores information like the number of nodes and creates a matrix to
store the connectivity information of the topology and is known as the General
Operation Director
set n0 [$ns node] creates a node. A node in NS is compound object made of address
(attached to routing module) and port classifiers (attached to transport agent).
$ns duplex-link $n0 $n1 1Mb 10ms DropTail creates two simplex links of specified
bandwidth, delay, and queue type and connects the two specified nodes. When a node
wants to send a packet through a link, it puts the packet on the queue object of the link.
Packets de-queued from the queue object are passed to the delay object. The delay object
simulates link delay. Sending a packet to a null agent from the queue object simulates the
dropping of the packet. The TTL object calculates the time to live of each packet received
and updates the TTL field of the packet.
set tcp [new Agent/TCP] and set sink [new Agent/TCPSink] creates a TCP and
TCPSink agents, respectively. Default traffic flow is from TCP to TCPSink. Users can
create any agent or traffic sources in this way.
$ns attach-agent $n0 $tcp and $ns attach-agent $n1 $sink attaches an agent object
created to a node object.
$ns connect $tcp $sink connects the two agents specified. After two agents that will
communicate with each other are created, the next thing is to establish a logical network
connection between them. This line establishes a network connection by setting the
destination address to each others' network and port address pair.
set ftp [new Application/FTP] creates an instance of FTP Application for bulk data
transfer.
$ftp attach-agent $tcp attaches an FTP object to the TCP agent.
$ns at 10.0 "$ftp start" tells the FTP agent when to start sending data.
$ns at 160.0 “finish” tells the simulator object to execute the 'finish' procedure after
160.0 seconds of simulation time
$ns run start the simulation.
Mobile Node is a split object. In addition to the basic node model, it consists of a network
stack. The network stack for a mobile node consists of a link layer (LL), an ARP module
connected to LL, an interface priority queue (IFq), a Mac layer (MAC), a network interface
(netIF), all connected to a common wireless channel. These network components are created
and plumbed together in OTcl. A packet sent down the stack flows through the link layer
(and ARP), the Interface queue, the MAC layer, and the physical layer. At the receiving node,
the packet then makes its way up the stack through the Mac, and the LL.
Figure 7.3 Basic Structure of a Mobile Node.
The following API configures for a mobile node with all the given values of adhoc-routing
protocol, network stack, channel, topography, propagation model, with wired routing turned
on or off (required for wired-cum-wireless scenarios) and tracing turned on or off at different
levels (router, Mac, agent).
$ns node-config -adhocRouting $val(rp) \ # dsdv/dsr/aodv/tora
-llType $val(ll) \ #specifies link layer object
-macType $val(mac) \ # specifies mac object
-ifqType $val(ifq) \ # specifies ifq object
-ifqLen $val(ifqlen) \ # specifies length of ifq
-antType $val(ant) \ # specifies antenna object
-propType $val(prop) \ # propagation object
-phyType $val(netif) \ # specifies physical layer object
-topoInstance $val(topo) \ # specifies topography
-channelType $val(chan) \ # specifies channel object
-energyModel $val(energymodel\ # specifies energymodel object
-initialEnergy $val(initialenergy) \ # specifies initial energy
-wiredRouting OFF \ # specifies routing type
-agentTrace ON \ # tracing the agent
-routerTrace ON \ # tracing the router
-macTrace OFF \ #trace node’s MAC layer
-movementTrace ON # tracing the movement
A mobile node is created using the following procedure:
This procedure creates a mobile node (split)object, creates an adhoc-routing routing agent as
specified, creates the network stack consisting of a link layer, interface queue, Mac layer, and
a network interface with an antenna, uses the defined propagation model, interconnects these
components and connects the stack to the channel.
The Mobile Node is designed to move in a three dimensional topology. However, the third
dimension (Z) is not used. That is the Mobile Node is assumed to move always on a flat
terrain with Z always equal to 0. Thus the Mobile Node has X, Y, Z (=0) co-ordinates that is
continually adjusted as the node moves. We first need to define the topography creating the
mobile nodes. Normally flat topology is created by specifying the length and width of the
topography using the following primitive:
At $time sec, the node would start moving from its initial position of (x1,y1) towards a
destination (x2,y2) at the defined speed.
So initially, all the nodes depending on their position are divided into cluster. The node which
is nearest to the BS is elected as the CH of that cluster. This is also known as “Distance based
Election of a CH”. Communication is set up between the end nodes and their respective CH
and also all the CH aggregates the data and after a certain interval, report that data to the BS.
Sensor nodes are dynamic in nature. They make inter or intra cluster movements. The only
constraint is that whenever a node moves to another cluster it should know its new CH. It is
done depending on the position of that node which is enlisted in that cluster as mentioned
above. This is called as “Clustering of the nodes” and it is done after every specific time
interval. Consider a special case like, CH of a certain cluster itself, moves to another cluster.
In such a situation, the current CH is made an end node and CH is elected from the remaining
nodes of the cluster.
CH being just another sensor node like other end nodes has energy constraints. As it manages
the whole cluster its energy depletion rate is more than that of the end nodes. So, in order to
maintain optimum energy levels of all the nodes in the cluster, CH re-election is initiated
after every certain period of time. This saves the cluster from being unstable, as CH can be
dead and management of the cluster becomes unstable. So, “Energy Based Re-election of
CH” is held in every cluster.
Energy Based Re-election means energies of all the nodes including the current CH in that
respective cluster are compared. The node having the highest energy level at that point of
time is appointed as the new CH. Then all the nodes communicate to the new CH.
There have been drastic drops observed in the energy levels of CH when there is no Energy
Based Re- election. Further, these energy levels drop, to extreme values when the load (in
terms of number of end nodes) is increased under a certain CH. But with Energy Based Re-
election applied, the energy levels of CH are maintained at an optimum level, even though;
the load under the CH was increased. It is also observed that the whole network works with
more efficiency and stability under this re-election scheme.
CHAPTER 8
ANALYSIS
CHAPTER 8
ANALYSIS
8.1 SCENARIO 1
4 clusters, 5 nodes under one CH
In this scenario, there are four clusters, each electing their respective CH based on distance.
The node in the cluster closest to the BS is elected as the CH. There are approximately five
nodes operating under one CH. The nodes send the data to CH and it forwards the data to the
BS. It is obvious that compared to other nodes, the CH will consume more energy.
The Xgraph for Scenario 1 is an Energy Vs Time graph which shows the energy level of
three nodes during the lifetime of the simulation. The blue line shows the energy levels of the
CH. It can be seen that the CH consumes the maximum energy. As the number of nodes
under one CH will increase, the CH will consume greater energy.
8.2 SCENARIO 2
4 clusters, 20 nodes under one CH
In this scenario, there are four clusters but we make cluster number 1 as our point of focus.
The cluster contains 20 nodes operating under one CH. In this scenario, the CH is elected
based on distance. The node closest to the BS becomes the CH. All the 20 nodes operating
under one CH send the data to the CH which forwards the data to the BS. In this case, the
energy of the node which gets elected as the CH reduces faster than the first scenario and that
node will wear off faster
Figure 8.3 Snapshot of Scenario2
The XGRAPH for Scenario 2 is Energy Vs Time graph for three nodes from cluster number
1. The blue line shows the energy level of the CH. Hence, the energy requirement of the CH
goes up and the node might wear off faster than other nodes in the network. Compared to the
Scenario 1, the CH in Scenario 2 requires much more energy.
8.3 SCENARIO 3
4 clusters, 20 node in the cluster, CH re-election based on energy
When comparison is made between the CH of first and second scenario, it can be observed
that, as the number of nodes of a cluster increase the energy required by the CH increases
drastically. But when CH re-election algorithm is applied the energy is used more efficiently.
So it can be concluded that using the energy based re-election of CH algorithm the shelf life
of nodes can be increased.
CHAPTER 9
CONCLUSION
CHAPTER 9
CONCLUSION
WSN has a wide scope of application and it plays a very important role in collection of data
in these applications. But while working in WSN, its limitations must also be taken into
consideration. We have learnt about the various aspects of a sensor node like its internal
structure, features and limitation. But our area of focus is to provide an efficient solution to
the problem of energy limitation in sensor nodes. As observed from the results of the
implemented scenarios, it can be seen that re-election of CH on basis of energy of nodes can
help in increasing the life of the nodes. Thus, we have successfully simulated the
conservation of energy of sensor nodes by applying an energy efficient algorithm for CH re-
election. We have also achieved other objectives like handling the intra and inter cluster
movement of sensor nodes, grid based clustering and distance based election of CH.
CHAPTER 10
FUTURE SCOPE
CHAPTER 10
FUTURE SCOPE
As wireless sensor networks continue to grow, so does the need for effective security
mechanisms. Because sensor networks may interact with sensitive data and/or operate in
hostile unattended environments, it is imperative that these security concerns be addressed
from the beginning of the system design. However, due to inherent resource and computing
constraints, security in sensor networks poses different challenges than traditional
network/computer security. There is currently enormous research potential in the field of
wireless sensor network security.
Because of the nature of wireless communications, resource limitation on sensor nodes, size
and density of the networks, unknown topology prior to deployment, and high risk of physical
attacks to unattended sensors, it is a challenge to provide security in WSNs. The ultimate
security requirement is to provide confidentiality, integrity, authenticity, and availability of
all messages in the presence of resourceful adversaries. To provide secure communications
for the WSNs, all messages have to be encrypted and authenticated. Security attacks on
information flow can be widespread. Modification of information is possible because of the
nature of the wireless channels and uncontrolled node environments. An opponent can use
natural impairments to modify information and also make the information unavailable. WSNs
have the general security requirements of availability, integrity, authentication, confidentiality
and non-repudiation.
APPENDIX A
NS-2
APPENDIX A
NS-2
A.1 Introduction to Network Simulator (NS2)
NS supports a compiled class hierarchy in C++ and also similar interpreted class hierarchy in
OTcl. From the user’s perspective, there is a one-to-one correspondence (see Figure 4.1)
between a class in the interpreted hierarchy and a class in the compiled hierarchy. The root of
this class hierarchy is the class TclObject. Users create new simulator objects through the
interpreter. These objects are instantiated within the interpreter and are closely mirrored by a
corresponding object in the compiled hierarch y. The interpreted class hierarchy is
automatically established through methods defined in class TclClass while user instantiated
objects are mirrored through methods defined in class TclObject.
Figure A.1 C++ -- OTcl linkage.
The following classes are mainly responsible for maintaining C++ and OTcl linkage.
• Class Tcl: This class encapsulates the actual instance of the OTcl interpreter, and
provides methods to access and communicate with that interpreter. It provides
methods for obtaining a reference to Tcl instance, invoking OTcl procedures through
the interpreter, getting or passing the results to the interpreter, storing and looking up
“TclObjects” etc.
• Class TclObject: It is the base class for most of the other classes in the interpreted
and compiled hierarchies. Every object in the class TclObject is created by the user
from within the interpreter and an equivalent shadow object is created in the compiled
hierarchy. The class TclClass performs this shadowing.
• Class TclClass: This is a pure virtual compiled class. Classes that are derived from
this base class provide two functions: constructing the interpreted class hierarchy to
mirror the compiled class hierarchy- and providing methods to instantiate new
TclObjects.
• Class EmbeddedTcl: The objects in this class are responsible for loading and
evaluating some NS scripts that are required at initialization.
• Class InstVar: This class defines the methods and mechanisms to bind a C++
member variable in the compiled shadow object to a specified OTcl instance variable
in the equivalent interpreted object. This binding allows setting or accessing the
variable from within the interpreter or compiled code at all times.
A.4 Major Components
Figure A.2 shows some major network components model in NS along with their place in
the class hierarchy. The root of the hierarchy is the TclObject class that is the super class
of all OTcl library objects. NsObject, the direct descendent of the TclObject, is the super
class of all basic network component objects that handle packets, which may compose
compound network objects such as nodes and links. The basic network components are
further divided into two subclasses, Connector and Classifier, based on the number of the
possible output data paths. The basic network objects that have only one output data path
are under the Connector class, and switching objects that have possible multiple output
data paths are under the Classifier class.
There are several simulators that have been used in sensor network research.
SensorSim
SensorSim, which has been built on NS-2, is a simulation framework for sensor
networks. It provides sensor channel models, energy consumers; lightweight
protocol stacks for wireless micro sensors, scenario generation and hybrid
simulation. The sensor channel models the dynamic interaction between the sensor
nodes and the physical environment. At each node, energy consumers are said to
control the power in multiple modes to efficiently use the power and prolong the
nodes lifetime. But this simulator is no longer developed, therefore, no more
available.
J-Sim
GloMoSim
SENS
TOSSIM
OMNeT++
Why NS2?
[2] “Introduction to Network Simulator NS2”, Teerawat Issariyakul & Ekram Hossain,
2009, Springer, www.cs.pitt.edu/Courses/Sensors/intro_to_ns2.pdf, 978-0-387-71759-
3, [accessed 28 July 2011].
[5] “An Energy-efficient Grid based Clustering Topology for a Wireless Sensor Network”,
Ketki Ram Bhakare, Computer Science & Engg RCERT, Chandrapur, India, February
2012.
[7] “Energy Efficient Protocols for Wireless Sensor Networks”, Md. Enamul Haque,
Department of Information and Computer Sciences Graduate School of Science and
Engineering Saitama University, September 2010.
[8] “Real-time support and energy efficiency in Wireless sensor networks.”, Mahmood Ali
and Sai Kumar Ravula, School of Information Science, Computer and Electrical
Engineering Halmstad University, January 2008.
[9] “An Novel Energy Balanced Dynamic Routing Protocol Based on Probability in
Wireless Sensor Networks”, Ming Zhang, Department of Electronic Engineering,
Huaihai Institute of Technology, March 2011.
[10] “A survey on clustering algorithms for wireless sensor network”, Ameer Ahmed Abbasi
& Mohamed Younis, Department of Computer Science and Electrical Engineering,
University of Maryland, www.elsevier.com/locate/com, 21 June, 2007.
[11] Li Qun; Aslam, Javed; Rus, Daniella. Hierarchical Power-aware Routing in Sensor
Networks Rutgers University, http://www.cs.wm.edu/paper/dimacs.pdf, May 21, 2001.
[14] “Routing Protocols in Wireless Sensor Networks – A Survey”, Shio Kumar Singh & M
P Singh & D K Singh, Department Of Computer Science and Engineering National
Institute of Technology,
[15] http://isi.edu/nsnam/ns