ppt taken workshoponwsn_withns2

64
Wireless Sensor Network Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) Indian Institute of Information Technology and Management Gwalior-474015, INDIA [email protected] March 25, 2014 Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G) WSN March 25, 2014 1 / 64

Upload: vishnu-kumar-prajapati

Post on 11-May-2015

263 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Ppt taken workshoponwsn_withns2

Wireless Sensor Network

Vishnu Kumar PrajapatiM.Tech CSE(Advanced Networks)

Indian Institute of Information Technology and ManagementGwalior-474015, [email protected]

March 25, 2014

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 1 / 64

Page 2: Ppt taken workshoponwsn_withns2

Sensor Network

A WSN is a wireless network consisting of spatially distributedautonomous devices using sensors to cooperatively monitor physical orenvironmental conditions, such as temperature, sound, vibration, pressure,motion, at different locations.

Large networks of simple sensors.

Usually deployed randomly.

Use broadcast paradigms to communicate with other sensors.

Collect information and send it to base station.

Must focus on power conservation.

Two type of sensor network

Static sensor network.

Dynamic sensor network.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 2 / 64

Page 3: Ppt taken workshoponwsn_withns2

Sensor Node

Node = sensing + processing + communication

Figure: Sensor Node

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 3 / 64

Page 4: Ppt taken workshoponwsn_withns2

Mobile sensor Node

Figure: Mobile Sensor Node

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 4 / 64

Page 5: Ppt taken workshoponwsn_withns2

Sensor characteristics

Consume low power

Autonomous

Operate in high volumetric densities

Adaptive to environment

cheap

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 5 / 64

Page 6: Ppt taken workshoponwsn_withns2

Communication Radio Frequency

Devices communicate synchronous, using primitives that take unittime (pulse)

If one sensor receives more than one message, there is collision(noise), due to interference the real network is a subgraph

Broadcasting

Deterministic broadcasting: every node transmit to its neighbours. Itcreates a lot of interface. Need assignment of channels.

Randomized broadcasting: at each time the sensors receiving a signalto rely it, each choose a random integer. Fewer interferences,Consume more energy, More time to transmit a message and Wellstudied analytically.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 6 / 64

Page 7: Ppt taken workshoponwsn_withns2

Why we use IEEE 802.15.4 ?

Figure: IEEE 802.15.4

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 7 / 64

Page 8: Ppt taken workshoponwsn_withns2

Zigbee

Zigbee is a new wireless technology guided by the IEEE 802.15.4 PersonalArea Networks standard. It is primarily designed for the wide rangingautomation applications and to replace the existing non-standardtechnologies.Some of its primary features are:

A standards-based wireless technology

Interoperability and worldwide usability

Low data-rates

Ultra low power consumption

Very small protocol stack

Support for small to excessively large networks

Simple design

Security, and

Reliability

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 8 / 64

Page 9: Ppt taken workshoponwsn_withns2

WSN Architecture

Figure: Wireless Sensor Architecture

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 9 / 64

Page 10: Ppt taken workshoponwsn_withns2

WSN Architecture with OSI Model

Figure: WSN Architecture with OSI Model

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 10 / 64

Page 11: Ppt taken workshoponwsn_withns2

IEEE 802.15.4 Main Characteristics

Data rates of 250kb/s, 40kb/s and 20 kb/s

Star or peer-to-peer operation

Support for low latency devices

CSMA-CA channel access

Dynamic device addressing

Fully handshake protocol for transfer reliability

Low power consumption

Frequency bands of operation16 channels in the 2.4GHz ISM band10 Channels in the 915MHz ISM band1 Channel in the 868MHz band

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 11 / 64

Page 12: Ppt taken workshoponwsn_withns2

802.15.4 Protocol Architecture

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 12 / 64

Page 13: Ppt taken workshoponwsn_withns2

802.15.4 Channel Assignment

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 13 / 64

Page 14: Ppt taken workshoponwsn_withns2

802.15.4 MAC Design Drivers

Extremely low cost

Ease of implementation

Reliable data transfer

Short range operation

Very low power consumption

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 14 / 64

Page 15: Ppt taken workshoponwsn_withns2

802.15.4 Device Classes

Co-ordinator: It is a device which is authorised to providesynchronization services in an established network. There can be twodifferent kinds of co-ordinators based on their operation scope. Firstis the PAN-Corodinator, which acts as a coordinator for the entirePAN. Where as an ordinary co-ordinator can only function within thescope of a cluster.

Full function device (FFD)

Any topologyPAN coordinator capableTalks to any other device

Reduced function device (RFD)

Cannot become a network coordinatorTalks only to a network coordinatorLimited to star topologyVery simple implementation

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 15 / 64

Page 16: Ppt taken workshoponwsn_withns2

802.15.4 Data Transmission

Transmission from the coordinator to the deviceTransmission from a device to the coordinatorTransmission between any two devices.

Figure: Transmission from the coordinator to the device

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 16 / 64

Page 17: Ppt taken workshoponwsn_withns2

802.15.4 Data Transmission

Transmission from a device to the coordinator

Figure: Transmission from a device to the coordinator

There is no predefined manner in which there can be a directcommunication between two devices in the network. However, the suitablemethods of transmission can be by mutual synchronization techniques, ordirect transmission using unslotted CSMA-CA.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 17 / 64

Page 18: Ppt taken workshoponwsn_withns2

Real Time Routing

Real time routing protocol can classified into two way.

Real time routing protocol for static WSN

RTLD is a real time with load distribution for WSN. It compute theoptimal forwarding node based on the packet reception rate, remain powerof sensor nodes and packet velocity over one hop.

Real time routing protocol for MWSN

It computes the optimal forwarding node based on RSSI, Remainingbattery level of sensor nodes and packet delay over one hop.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 18 / 64

Page 19: Ppt taken workshoponwsn_withns2

Applications of WSNs

Constant monitoring and detection of specific events

Military, battlefield surveillance

Forest fire and flood detection

Habitat exploration of animals

Patient monitoring

Home appliances

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 19 / 64

Page 20: Ppt taken workshoponwsn_withns2

Design Issues and Challenges

Random deployment

Infrastructure-less networks

Low Energy consumption

Hardware energy efficiency

Distributed synchronization

Adapting to changes in connectivity

Real-time communication, QoS

Security

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 20 / 64

Page 21: Ppt taken workshoponwsn_withns2

Design Factors

ScalabilityFault tolerancePower consumptionSensor network architectures

LayeredClustered

Figure: Layered Architecture

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 21 / 64

Page 22: Ppt taken workshoponwsn_withns2

WSN Architecture

Figure: Wireless Sensor Architecture

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 22 / 64

Page 23: Ppt taken workshoponwsn_withns2

RTLD Protocol

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 23 / 64

Page 24: Ppt taken workshoponwsn_withns2

Location Management

It assume that all sensor nodes are in a fixed possion. It also assumes thatthe sink node is at the origin (0,0) and at least two of its neighbours arelocation aware.The location mechanism uses at least tree signal strengh measurementsextracted from Request to route (RTR) packet braodcasted bypre-determind nodes at various intervals. Each pre-determind nodebroadcasts RTR packet and insert its location in the packet header.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 24 / 64

Page 25: Ppt taken workshoponwsn_withns2

Routing management

The routing management consist of three sub functional processes.

Forwarding metrics calculation

Forwarding mechanism

Routing problem handler

Forwarding metrics calculation

The optimal forwarding calculation is used to calculate next hop based onthe forwarding metrics that include PRR, packet velocity and remainingpower. The routing problem handler is used to solve the routing holeproblem due to hiddel sensor nodes in WSN.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 25 / 64

Page 26: Ppt taken workshoponwsn_withns2

Forwarding mechanism

The source node check the forward flag of each neighbour in theneighbour table. if the forward flag is 1, the source node will check theoptimal forwarding metrics and compute forwarding progress and find theoptimal path. If there are no nodes in the direction to the destination, thesource node will invoke the neighbour discovery, the data packet will beunicast to the selected node. This procedure continues until thedestination is one of the selected node’s neighbours.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 26 / 64

Page 27: Ppt taken workshoponwsn_withns2

routing Problem Handler

It may fail to find a route in the presence of network holes even withneighbour discovery. Such holes may appear due to voids in nodedeployment or subsequent node failures over the lifetime of the network.Routing management in RTLD solves this problem by introducing routingproblem handler which has two recovery methods.fast recovery using power adaptation and slow recovery using feedbackcontrol packet.The fast recovery is applied when the diameter of the hole is smaller thanthe transmission range at the maximum power. The routing problemhandler will inform neighbour discovery to identify a maximumtransmission power required to efficiently transmit the packet across thehole.In the slow recovery, candidate OF node will send feedback packet to itsparent. The feedback packet will inform the sensor node parent to stopsending data packet toward OF sensor node. When the parent receivedfeedback control packet, it will calculate OF again for all candidates.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 27 / 64

Page 28: Ppt taken workshoponwsn_withns2

Neighbour Management

It is to discover a subset of forwarding candidate nodes and to maintainneighbour table of the forwarding candidate nodes. Due to limited memoryand large number of neighbours, the neighbour table is limited to a smallset of forwarding candidates that are most useful in meeting the one-hopend-to-end delay with the optimal PRR and remaining power.

In the Neighbour table contain maximum 16 nodes information.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 28 / 64

Page 29: Ppt taken workshoponwsn_withns2

Power Management

The main function of power management is to adjust the power of thetransceiver and select the level of transmission power of the sensor node.It significantly reduces the energy consumed in each sensor node betweenthe source and the destination in order to increase node lifetime span.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 29 / 64

Page 30: Ppt taken workshoponwsn_withns2

RTLD Protocol Limitation

It work well when sensor node are not moveable

If PAN coordinator is fail then whole network fail

Neighbour discovery is possible only predetermine three node.

It work only Location base, if sensor nodes are random thenneighbour discovery fail.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 30 / 64

Page 31: Ppt taken workshoponwsn_withns2

MWSN Architecture

Figure: Mobile Wireless Sensor Architecture

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 31 / 64

Page 32: Ppt taken workshoponwsn_withns2

ERTLD Protocol

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 32 / 64

Page 33: Ppt taken workshoponwsn_withns2

Sensor Location Management

RTLD is depending on location management to calculate the sensor nodelocation based on the distance to three pre-determined neighbour nodes.However, geographic forwardingbased is suitable for static WSN and leadsto poor performance when the sink and/or intermediate nodes are mobile.Hence ERTLD used corona mechanism as a replacement to location basedrouting.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 33 / 64

Page 34: Ppt taken workshoponwsn_withns2

Corona Mechanism For Broadcasting

Figure: Corona Mechanism for broadcasting

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 34 / 64

Page 35: Ppt taken workshoponwsn_withns2

Corona Mechanism For Unicasting

Figure: Corona Mechanism for Unicasting

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 35 / 64

Page 36: Ppt taken workshoponwsn_withns2

Corona Mechanism

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 36 / 64

Page 37: Ppt taken workshoponwsn_withns2

Routing management

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 37 / 64

Page 38: Ppt taken workshoponwsn_withns2

Routing Problem Handler

In ERTLD, if a mobile sensor node cannot forward data packets to thenext-hop neighbour, it backwards the data packet to any node in highcorona level and it will inform its parent to stop sending data. The parentwill select new forwarding candidate. Hence, the backward mechanismguarantees to prevent dropping of data packet at the mobile node or itsparent. This flexibility is not founded on RTLD.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 38 / 64

Page 39: Ppt taken workshoponwsn_withns2

Forwarding Mechanism

The source node checks the C ID of each neighbour in the neighbourtable. If the C ID of any neighbour node is less or equal to source nodeC ID, the optimal forwarding algorithm will be invoked to choose theoptimal neighbour. If there is no node in neighbour table has C ID less orequal to source nodes C ID, the source node will invoke the neighbourdiscovery. Once the optimal forwarding choice is obtained, the data packetwill be unicast to the selected node. This procedure continues until theMS is one of the selected nodes neighbours.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 39 / 64

Page 40: Ppt taken workshoponwsn_withns2

Optimal Neighbour Selection

RTLD computes optimal forwarding node based on PRR, remaining powerof sensor nodes and packet velocity over one-hop. PRR reflects the diverselink qualities within the transmission range and approximately calculatedas the probability of successfully receiving a packet between two neighbournodes. If PRR is high that means the link quality is high and vice versa.However, PRR requires extra time, more energy and complexitymathematical calculation based on IEEE 802.15.4/Zigbee RF transceiver.Hence, ERTLD saves calculation time by utilizing RSSI which is a built-inphysical layer parameter and does not require any extra calculation.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 40 / 64

Page 41: Ppt taken workshoponwsn_withns2

Neighbour Discovery

The neighbour discovery procedure is executed in the initialization stage toidentify a node that satisfies the forwarding condition. The neighbourdiscovery mechanism introduces small communication overhead. This isnecessary to minimize the time it takes to discover a satisfactoryneighbour. The source node invokes the neighbour discovery bybroadcasting RTR packet. Some neighbouring nodes will receive the RTRand send a reply. Upon receiving the replies, the neighbourhoodmanagement records the new neighbour in its neighbour table.The neighbour table contain following field. node ID, corona ID (C ID),remaining power, one hop end to end delay, RSSI, corona control packetID (CCP ID), location information and expiry time.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 41 / 64

Page 42: Ppt taken workshoponwsn_withns2

Power Management

In ERTLD, the sensor node sleeps most of the time and it changes itsstate to idle if it has neighbour in the direction of the destination. Inaddition, if the sensor node wants to broadcast RTR, it changes its stateto transmit mode. After that, it changes to receive mode if it receivesreplies or data packet from its neighbour.Since the time taken to switch from sleep state to idle state takes close to1ms, it is recommended that a sensor node should stay in the idle state ifit has neighbours. Thus, the total delay from the source to the destinationwill be decreased. In addition, a sensor node should change its state fromidle to sleep if it does not have at least one neighbour in the neighbourtable that can forward data packets to the destination.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 42 / 64

Page 43: Ppt taken workshoponwsn_withns2

Improvement in ERTLD Protocol

The corona width is less than the transmission range, in this case thenetwork performance increases.

A network has a Mobile Sink (MS), if the MS fail or below ofthreshold value that establishing a new MS node take more time tore-establish. In the MS node has a voice sink node that if fails sinknode we use the voice sink, by using voice sink the overall lifetime areincreasing in the sensor network and reduce the delay.

The Routing hole problem is solved by the slow recovery usingbackward mechanism. We do not use a fast recovery using poweradaptation because the power consumption is saved.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 43 / 64

Page 44: Ppt taken workshoponwsn_withns2

NS2

Installation instructions

Using related tools (nam, xgraph, etc)

NS-2 official website and documentation

Sample coding exercises

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 44 / 64

Page 45: Ppt taken workshoponwsn_withns2

What is simulation?

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 45 / 64

Page 46: Ppt taken workshoponwsn_withns2

Why Simulation?

real-system not available, is complex/costly or dangerous (eg: spacesimulations, flight simulations)

quickly evaluate design alternatives (eg: different systemconfigurations)

evaluate complex functions for which closed form formulas ornumerical techniques not available

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 46 / 64

Page 47: Ppt taken workshoponwsn_withns2

Simulation: advantages/drawbacks

advantages

sometimes cheaperfind bugs (in design) in advancegenerality: over analytic/numerical techniquesdetail: can simulate system details at arbitrary level

drawbacks

caution: does model reflect realitylarge scale systems: lots of resources to simulate (especially accuratelysimulate)may be slow (computationally expensive 1 min real time could behours of simulated time)art: determining right level of model complexitystatistical uncertainty in results

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 47 / 64

Page 48: Ppt taken workshoponwsn_withns2

Simulator Block Diagram

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 48 / 64

Page 49: Ppt taken workshoponwsn_withns2

What is NS2?

NS2 is an object oriented, discrete event simulator, developed under theVINT project as a joint effort by UC Berkeley, USC/ISI, LBL, and XeroxPARC. It was written in C++ with OTcl as a front-end. The simulatorsupports a class hierarchy in C++ (compiled hierarchy), and a similar classhierarchy within the OTcl interpreter.

A package of tools that simulates behavior of networks

Create Network TopologiesLog events that happen under any loadAnalyze events to understand the network behavior

Creating TopologiesNodes

Set properties like queue length, locationProtocols, routing algorithms

Links

Set types of link Simplex, duplex, wireless, satelliteSet bandwidth, latency etc.

Done through tcl Scripts

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 49 / 64

Page 50: Ppt taken workshoponwsn_withns2

Installation Processes

Step 1: Make it sure that Internet connectivity is good. DownloadNS2.35 from http://www.isi.edu/nsnam/ns/

Step 2: Make a new folder [ns] in /Desktop/Extracts downloaded filesin above folder.

Step 3: copy downloaded ns-allinone-2.35.tar.gz in /Desktop/ns/

Step 4: open terminal

Step 5: Run following commands

cd Desktop/ns-allinone-2.35

sudo apt-get update

sudo apt-get install build-essential autoconf automake libxmu-dev

Step 6: Run following command ./install

Step 7: Run following command to install X graphsudo apt-get install xgraph

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 50 / 64

Page 51: Ppt taken workshoponwsn_withns2

Conti.....

Step 8: Set environment variables by run this commandgedit / .bashrc

Add the following lines to the end of the file. Remember replace”/your/path” by the folder where you have stored extracted the ns-2 file(For example, if your Linux account name is purple, and you haveextracted the file to your Desktop directory, you have to change /yourpath to /Desktop/ns)

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 51 / 64

Page 52: Ppt taken workshoponwsn_withns2

conti...

#LD LIBRARY PATHOTCL LIB = /your/path/ns − allinone − 2.35/otcl − 1.13NS2 LIB = /your/path/ns − allinone − 2.35/libX11 LIB = /usr/X11R6/lib USR LOCAL LIB = /usr/local/libexportLD LIBRARY PATH = LD LIBRARY PATH : OTCL LIB :NS2 LIB : X11 LIB : USR LOCAL LIB#TCL LIBRARYTCL LIB = /your/path/ns − allinone − 2.35/tcl8.4.18/libraryUSR LIB = /usr/lib exportTCL LIBRARY = TCL LIB : USR LIB#PATHXGRAPH = /your/path/ns − allinone − 2.35/bin : /your/path/ns −allinone − 2.35/tcl8.4.18/unix : /your/path/ns − allinone−2.35/tk8.4.18/unix NS = /your/path/ns − allinone − 2.35/ns − 2.35/NAM = /your/path/ns − allinone − 2.35/nam − 1.14/PATH = PATH : XGRAPH : NS : NAM

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 52 / 64

Page 53: Ppt taken workshoponwsn_withns2

Conti....

Step 9: run following commandsource /.bashrcNow you can run your ns with ns command... The ”%” symbolappears on the screen.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 53 / 64

Page 54: Ppt taken workshoponwsn_withns2

NS2 Simulation Model

Figure: NS2 Simulation Model

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 54 / 64

Page 55: Ppt taken workshoponwsn_withns2

How Do I use it?

Creating a Simple Topology

Getting Traces

Using NAM

Basics of using NS2

Define Network topology, load, output files in Tcl Script To run,

ns simple network.tcl

Internally, NS2 instantiates C++ classes based on the tcl scripts

Output is in form of trace files

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 55 / 64

Page 56: Ppt taken workshoponwsn_withns2

A simple Example Creating the topology

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 56 / 64

Page 57: Ppt taken workshoponwsn_withns2

simulator produces the resultant network performanceanalysis

The simulator needs the tcl scenario file as input. So the intended scenarioof the network is presented as a sequence of tcl commands which are fedto the network simulator, and the simulator produces the resultant networkperformance analysis in two separate files. They are:

Trace File (*.tr): The trace file contains information about the variousevents that occurred during the simulation duration. It contains everydetail of node behavior, packet transmissions and receptions, packettype, layer responsible for communication, drops and reasons fordrops, energy consumption, etc, to the utmost possible precision.

NAM Trace file (*.nam): The network animator trace file containsinformation about topology, e.g; nodes, links, as well as packet traces.It can be said as a mirror of the trace file, with the exception that ituses a different syntax to work with the visualize.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 57 / 64

Page 58: Ppt taken workshoponwsn_withns2

Process Structure

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 58 / 64

Page 59: Ppt taken workshoponwsn_withns2

Functioning

Throughput

Minimum Delay

Maximum Delay

Average Delay

Data Packets Transmitted

Data Packets Successfully Received by their Respective Destinations

Data Packet Delivery Ratio

Average Initial Energy

Average Energy Used

Average Percentage Energy Used

Node Packet Discrepancy Ratio

Packet Drop statistics

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 59 / 64

Page 60: Ppt taken workshoponwsn_withns2

Simulation Parameters

Traffic ParametersTraffic TypeNumber of FlowsPacket SizeTraffic Direction

Node ParametersNumber of NodesCoordinatorsNode MovementNode Position

Physical ParametersRadio Propogation ModelAntenna TypeTransmitter GainReceiver GainPathLoss

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 60 / 64

Page 61: Ppt taken workshoponwsn_withns2

Routing

Routing is a method of determining routes to nodes to which informationis due for transfer. The routing mechanism is guided with routing tables,which holds the best path to the destination node. These tables mighthave a direct path to the destination or a path to the nearest node, whichcan forward the information further, thus bridging the route to thedestination node. A node which has data to be transmitted to adestination node, first looks up into its routing table, to determine if apath to the destination is available. If yes, it would go ahead with thetransmission to the next nearest node in the path or may transmit a RouteRequest message to determine a route to the node.

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 61 / 64

Page 62: Ppt taken workshoponwsn_withns2

How can I add to NS2?

Adding Protocols to NS2 is possible

Need to create the C++ classNeed to create the OTcl Linkage

More info at:

http://www.isi.edu/nsnam/ns/tutorial/index.htmlTutorial about how to add a simple protocol to NS2

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 62 / 64

Page 63: Ppt taken workshoponwsn_withns2

REFERENCES

A. Ahmed, N. Fisal, ”A real-time routing protocol with loaddistribution in wireless sensor networks”, Elsevier ComputerCommunication Journal 31 (2008) 3190-3203.

A Ahmed, ”An enhanced real time routing protocol with loaddistribution for mobile wireless sensor networks”, Elsevier ComputerCommunication February 19 (2013) 1459-1473.

G. M. Arau jo, L.B. Becker, ”A network conditions awaregeographical forwarding protocol for real-time applications in mobilewireless sensor networks”, in: AINA 2011 IEEE InternationalConference, 2011,pp. 3845.

http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

http://www.tcl.tk/man/tcl8.6/TclCmd/contents.html

http://www.isi.edu/nsnam/ns.html

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 63 / 64

Page 64: Ppt taken workshoponwsn_withns2

Thank You ..

Vishnu Kumar Prajapati M.Tech CSE(Advanced Networks) (ABV IIITM-G)WSN March 25, 2014 64 / 64