SlideShare uma empresa Scribd logo
1 de 10
Running Wireless Simulations in NS
Creating a Mobile Node in NS
o A mobile node consists of a number of network components:
 Link Layer (LL) - tell node how to check packet integrity
 Interface Queue (IfQ) - buffer size
 MAC layer - tell node how to share broadcast medium
o NS supports different kinds of mobile network simulations;
You MUST configure the mobile nodes before you can create them.
o
o

Mobile nodes are configured using the command $ns node-config)
followed by one or more (name, value) pairs
The configuration API of mobile nodes looks as follows:
set ns_

[new Simulator]

# Configure mobile nodes
$ns_ node-config OPTION1 VALUE1 [OPTION2 VALUE2]...

o

Example: create mobile nodes that uses IEEE 802.11 MAC protocol
set ns_

[new Simulator]

# Configure mobile nodes
$ns_ node-config -macType

o

Mac/802_11

Example: create mobile nodes that uses IEEE 802.11 MAC protocol and
with a buffer of 50 packets
set ns_

[new Simulator]
# Configure mobile nodes
$ns_ node-config -macType
-ifqLen

o

Mac/802_11
50



Node configuration API may consist of:
 defining the type of addressing (flat/hierarchical etc)
 the type of adhoc routing protocol
 Link Layer
 MAC layer
 IfQ
 etc.

Configuring Mobile Nodes
o The following table contains the parameters and the most commonly
used options (802.11 network)
Option Name

Usage

How node
addressingType addresses are
organized
Routing
protocol used
by nodes in an
-adhocRouting
Ad Hoc
network (noninfrastructure)

Option values




flat
hierarchical
expanded





DSDV
DSR (Source Routing)
TORA

-llType

Link Layer
protocol



LL

-macType

MAC Layer
protocol



Mac/802_11

-propType

How radio
wave
propagate



Propagation/TwoRayGround
-ifqType

Queueing
method at the
interface

-ifqLen



Queue/DropTail/PriQueue

Queue size at
the interface



integer (e.g., 50)

-phyType

Type of
physical layer



Phy/WirelessPhy

-antType

Type of
antenna



Antenna/OmniAntenna

-channelType

Type of
channel



Channel/WirelessChannel



Create a topology object:
set topo [new Topography]
Define the grid size:
$topo load_flatgrid 500 500
Use the variable $topo as
parameter for this option

Description of
the wireless
-topoInstance
network
topology

-agentTrace

Flag to enable
writing of
trace data for
agent module

-routerTrace

Flag to enable
writing of
trace data for
wireless router
module

-macTrace

Flag to enable
writing of
trace data for
wireless MAC
module

Flag to enable
writing of
trace data for
-movementTrace
the movement
of wireless
nodes
o

NOTE:







ON
OFF




ON
OFF




ON
OFF




ON
OFF
All default values for these options are NULL except: addressingType: flat

Common values used in Wireless Simulation
o A very common way to keep option values in a single place is to used
an associative array (the indices of the array are names instead of
numbers)
o Here are some commonly used values for wireless simulations:
#
===========================================================
===========
# Define options
#
===========================================================
===========
set val(chan)
Channel/WirelessChannel ;# channel
type
set val(prop)
Propagation/TwoRayGround ;# radiopropagation model
set val(ant)
Antenna/OmniAntenna
;# Antenna
type
set val(ll)
LL
;# Link
layer type
set val(ifq)
Queue/DropTail/PriQueue ;#
Interface queue type
set val(ifqlen)
50
;# max
packet in ifq
set val(netif)
Phy/WirelessPhy
;# network
interface type
set val(mac)
Mac/802_11
;# MAC type
set val(rp)
DSDV
;# ad-hoc
routing protocol

o

After storing the values in the associative array $val, we can set the
options of wireless nodes as follows:
# ==================================================
# Configure nodes
# ==================================================
$ns_ node-config 
-channelType $val(chan) 
-propType $val(prop) 
-antType $val(ant) 
-llType $val(ll) 
-ifqType $val(ifq) 
-ifqLen $val(ifqlen) 
-phyType $val(netif)
-macType $val(mac) 
-adhocRouting $val(rp) 
-agentTrace ON 
-routerTrace ON 
-macTrace OFF 
-movementTrace OFF 
-topoInstance $topo



Don't worry about the variable $topo, we will cover that later.

Topology
o The wireless simulation needs to know the area in which the wireless
nodes can travel...
o For this purpose, NS has defined a Topology class to store information
about the mobile hosts that move in a grid...
o The create a Topology object, use:
set VARNAME [new Topography]
EXAMPLE:
set topo [new Topography]

o

To provide the topography object with x and y co-ordinates of the
boundary, use:
$TOPO_VARNAME load_flatgrid

X-SIZE

EXAMPLE:
$topo



load_flatgrid

500

500

Default granularity is 1

The General Operations Director (GOD) Object

Y-SIZE

[Granularity]
o
o

o
o

o

Unlike wired (immobile) network simulation, the location of mobile
hosts are not known when the simulation is in progress.
In order to determine whether 2 mobile nodes can communicate with
each other (i.e., whether they are within each others' range), NS needs to
find out their locations.
So NS must maintain some necessary information on ALL mobile
hosts
NS has defined a class to do so, and it is called "GOD" (General
Operations Director) - the acronym "GOD" seems appropriate since
this object knows information about every mobile hosts :-)
Before you can create a mobile host, you MUST first create
a "GOD" object, using the following command:
create-god

NUMBER-Of-Mobile-Nodes

The parameter NUMBER-Of-Mobile-Nodes is the number of mobile
hosts in the wireless simulation (you need to tell NS the amount of
space to reserve)
Some more information of the GOD class object:


o

The GOD (General Operations Director) object is used to store global
information about the state of the environment, network or nodes that an
omniscent observer would have, but that should not be made known to any
participant in the simulation.
A GOD object stores the total number of mobile nodes and a table of
shortest number of hops required to reach from one node to another.
The next hop information is loaded into GOD object from movement
pattern files, before simulation begins, since calculating this on the fly
during simulation runs can be quite time consuming.
o

NOTE:
Only ONE single global instance of the GOD object is to be
created during an NS simulation !!!

How to write a Wireless Simulation in NS
o OK, we know enough to write a simple wireless simulation in NS
o
o

Simulated Scenario:
Simulation program:
# simple-wireless.tcl
# A simple example for wireless simulation
#
===========================================================
===========
# Define options
#
===========================================================
===========
set val(chan)
Channel/WirelessChannel
;#
channel type
set val(prop)
Propagation/TwoRayGround
;#
radio-propagation model
set val(netif)
Phy/WirelessPhy
;#
network interface type
set val(mac)
Mac/802_11
;# MAC
type
set val(ifq)
Queue/DropTail/PriQueue
;#
interface queue type
set val(ll)
LL
;# link
layer type
set val(ant)
Antenna/OmniAntenna
;#
antenna model
set val(ifqlen)
50
;# max
packet in ifq
set val(nn)
2
;#
number of mobilenodes
set val(rp)
DSDV
;#
routing protocol
#
===========================================================
===========
# Main Program
#
===========================================================
===========
#
# Initialize Global Variables
#
set ns_
[new Simulator]
set tracefd
[open simple.tr w]
$ns_ trace-all $tracefd
# ---------------------------------------------------------------# Set up wireless network simulation
# ---------------------------------------------------------------# Create topography object to hold wireless scenario
set topo
[new Topography]
$topo load_flatgrid 500 500
500x500

;# Grid size is

#
# Create god object
#
create-god $val(nn)
#
# Create the specified number of mobilenodes [$val(nn)]
and "attach" them
# to the channel.
# Here two nodes are created : node(0) and node(1)
# configure node
$ns_ node-config -adhocRouting $val(rp) 
-llType $val(ll) 
-macType $val(mac) 
-ifqType $val(ifq) 
-ifqLen $val(ifqlen) 
-antType $val(ant) 
-propType $val(prop) 
-phyType $val(netif) 
-channelType $val(chan) 
-topoInstance $topo 
-agentTrace ON 
-routerTrace ON 
-macTrace OFF 
-movementTrace OFF
# -------------------------------------------------------# Direct mobile node's movements
# -------------------------------------------------------for {set i 0} {$i< $val(nn) } {incri} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0
random motion
}

;# disable

#
# Provide initial (X,Y, for now Z=0) co-ordinates for
mobilenodes
#
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 390.0
$node_(1) set Y_ 385.0
$node_(1) set Z_ 0.0
#
# Now produce some simple node movements
# Node_(1) starts to move towards node_(0)
#
$ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0"
$ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0"
# Node_(1) then starts to move away from node_(0)
$ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0"
# -------------------------------------------------------------# The rest is "ordinary" network connection setup
# -------------------------------------------------------------# Setup TCP connections between node_(0) and node_(1)
set tcp [new Agent/TCP]
$ns_ attach-agent $node_(0) $tcp
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(1) $sink
$ns_ connect $tcp $sink
# Setup FTP flow for TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns_ at 10.0 "$ftp start"
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i< $val(nn) } {incri} {
$ns_ at 150.0 "$node_($i) reset";
}
$ns_ at 150.0 "stop"
$ns_ at 150.01 "puts "NS EXITING..." ; $ns_ halt"
proc stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}
puts "Starting Simulation..."
$ns_ run

o

Example Program: (Demo above code)
 Prog file: click here

Trace Information from Wireless Simulation
o AgentTraces are marked with AGT in the 5th field
o RouterTrace are marked with RTR in the 5th field
o MacTrace are marked with MAC in the 5th fields.
o MovementTrace (shows the movement of the mobile nodes) are marked
with M in the 2nd field.
References
o Marc Greis' NS Tutorial Chapter IX. Running Wireless Simulations in ns
- click here

Mais conteúdo relacionado

Mais procurados

Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt IIAjit Nayak
 
Task based Programming with OmpSs and its Application
Task based Programming with OmpSs and its ApplicationTask based Programming with OmpSs and its Application
Task based Programming with OmpSs and its ApplicationFacultad de Informática UCM
 
CUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : NotesCUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : NotesSubhajit Sahu
 
CUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesCUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesSubhajit Sahu
 
Getting started with ES6
Getting started with ES6Getting started with ES6
Getting started with ES6Nitay Neeman
 
CUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : NotesCUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : NotesSubhajit Sahu
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойSigma Software
 
JSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notJSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notChengHui Weng
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Siouxnikomatsakis
 
CUDA Tutorial 02 : CUDA in Actions : Notes
CUDA Tutorial 02 : CUDA in Actions : NotesCUDA Tutorial 02 : CUDA in Actions : Notes
CUDA Tutorial 02 : CUDA in Actions : NotesSubhajit Sahu
 
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APIMario Fusco
 
SAE: Structured Aspect Extraction
SAE: Structured Aspect ExtractionSAE: Structured Aspect Extraction
SAE: Structured Aspect ExtractionGiorgio Orsi
 
User defined functions
User defined functionsUser defined functions
User defined functionsshubham_jangid
 

Mais procurados (20)

Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt II
 
Task based Programming with OmpSs and its Application
Task based Programming with OmpSs and its ApplicationTask based Programming with OmpSs and its Application
Task based Programming with OmpSs and its Application
 
CUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : NotesCUDA by Example : Introduction to CUDA C : Notes
CUDA by Example : Introduction to CUDA C : Notes
 
CUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : NotesCUDA by Example : Parallel Programming in CUDA C : Notes
CUDA by Example : Parallel Programming in CUDA C : Notes
 
Getting started with ES6
Getting started with ES6Getting started with ES6
Getting started with ES6
 
CUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : NotesCUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : Notes
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
JSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why notJSDC 2014 - functional java script, why or why not
JSDC 2014 - functional java script, why or why not
 
Js hacks
Js hacksJs hacks
Js hacks
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Sioux
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
NAS EP Algorithm
NAS EP Algorithm NAS EP Algorithm
NAS EP Algorithm
 
CUDA Tutorial 02 : CUDA in Actions : Notes
CUDA Tutorial 02 : CUDA in Actions : NotesCUDA Tutorial 02 : CUDA in Actions : Notes
CUDA Tutorial 02 : CUDA in Actions : Notes
 
glTF 2.0 Reference Guide
glTF 2.0 Reference GuideglTF 2.0 Reference Guide
glTF 2.0 Reference Guide
 
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java API
 
OpenSL ES 1.1 Reference Card
OpenSL ES 1.1 Reference CardOpenSL ES 1.1 Reference Card
OpenSL ES 1.1 Reference Card
 
SAE: Structured Aspect Extraction
SAE: Structured Aspect ExtractionSAE: Structured Aspect Extraction
SAE: Structured Aspect Extraction
 
4. functions
4. functions4. functions
4. functions
 
User defined functions
User defined functionsUser defined functions
User defined functions
 

Semelhante a Configure Mobile Nodes in NS-2

Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportMuragesh Kabbinakantimath
 
Working with NS2
Working with NS2Working with NS2
Working with NS2chanchal214
 
study-of-network-simulator.pdf
study-of-network-simulator.pdfstudy-of-network-simulator.pdf
study-of-network-simulator.pdfJayaprasanna4
 
Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Holden Karau
 
Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04Krishna Sankar
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Sparksamthemonad
 
Road Monitoring - 2019 - IoT@Sapienza - v3
 Road Monitoring - 2019 - IoT@Sapienza - v3 Road Monitoring - 2019 - IoT@Sapienza - v3
Road Monitoring - 2019 - IoT@Sapienza - v3Pietro Spadaccino
 
OpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-ServiceOpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-ServiceRamon Acedo Rodriguez
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Simon McCartney
 
Distributed Realtime Computation using Apache Storm
Distributed Realtime Computation using Apache StormDistributed Realtime Computation using Apache Storm
Distributed Realtime Computation using Apache Stormthe100rabh
 
C aptitude questions
C aptitude questionsC aptitude questions
C aptitude questionsSrikanth
 
C - aptitude3
C - aptitude3C - aptitude3
C - aptitude3Srikanth
 
NS2-tutorial.ppt
NS2-tutorial.pptNS2-tutorial.ppt
NS2-tutorial.pptWajath
 
Who pulls the strings?
Who pulls the strings?Who pulls the strings?
Who pulls the strings?Ronny
 

Semelhante a Configure Mobile Nodes in NS-2 (20)

Ns2
Ns2Ns2
Ns2
 
Ns network simulator
Ns network simulatorNs network simulator
Ns network simulator
 
Ns2programs
Ns2programsNs2programs
Ns2programs
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks report
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Linked list
Linked listLinked list
Linked list
 
Working with NS2
Working with NS2Working with NS2
Working with NS2
 
study-of-network-simulator.pdf
study-of-network-simulator.pdfstudy-of-network-simulator.pdf
study-of-network-simulator.pdf
 
Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014Spark with Elasticsearch - umd version 2014
Spark with Elasticsearch - umd version 2014
 
Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Spark
 
Road Monitoring - 2019 - IoT@Sapienza - v3
 Road Monitoring - 2019 - IoT@Sapienza - v3 Road Monitoring - 2019 - IoT@Sapienza - v3
Road Monitoring - 2019 - IoT@Sapienza - v3
 
OpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-ServiceOpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-Service
 
Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013Stack kicker devopsdays-london-2013
Stack kicker devopsdays-london-2013
 
Distributed Realtime Computation using Apache Storm
Distributed Realtime Computation using Apache StormDistributed Realtime Computation using Apache Storm
Distributed Realtime Computation using Apache Storm
 
C aptitude questions
C aptitude questionsC aptitude questions
C aptitude questions
 
C - aptitude3
C - aptitude3C - aptitude3
C - aptitude3
 
Tut hemant ns2
Tut hemant ns2Tut hemant ns2
Tut hemant ns2
 
NS2-tutorial.ppt
NS2-tutorial.pptNS2-tutorial.ppt
NS2-tutorial.ppt
 
Who pulls the strings?
Who pulls the strings?Who pulls the strings?
Who pulls the strings?
 

Último

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Último (20)

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

Configure Mobile Nodes in NS-2

  • 1. Running Wireless Simulations in NS Creating a Mobile Node in NS o A mobile node consists of a number of network components:  Link Layer (LL) - tell node how to check packet integrity  Interface Queue (IfQ) - buffer size  MAC layer - tell node how to share broadcast medium o NS supports different kinds of mobile network simulations; You MUST configure the mobile nodes before you can create them. o o Mobile nodes are configured using the command $ns node-config) followed by one or more (name, value) pairs The configuration API of mobile nodes looks as follows: set ns_ [new Simulator] # Configure mobile nodes $ns_ node-config OPTION1 VALUE1 [OPTION2 VALUE2]... o Example: create mobile nodes that uses IEEE 802.11 MAC protocol set ns_ [new Simulator] # Configure mobile nodes $ns_ node-config -macType o Mac/802_11 Example: create mobile nodes that uses IEEE 802.11 MAC protocol and with a buffer of 50 packets set ns_ [new Simulator]
  • 2. # Configure mobile nodes $ns_ node-config -macType -ifqLen o Mac/802_11 50 Node configuration API may consist of:  defining the type of addressing (flat/hierarchical etc)  the type of adhoc routing protocol  Link Layer  MAC layer  IfQ  etc. Configuring Mobile Nodes o The following table contains the parameters and the most commonly used options (802.11 network) Option Name Usage How node addressingType addresses are organized Routing protocol used by nodes in an -adhocRouting Ad Hoc network (noninfrastructure) Option values    flat hierarchical expanded    DSDV DSR (Source Routing) TORA -llType Link Layer protocol  LL -macType MAC Layer protocol  Mac/802_11 -propType How radio wave propagate  Propagation/TwoRayGround
  • 3. -ifqType Queueing method at the interface -ifqLen  Queue/DropTail/PriQueue Queue size at the interface  integer (e.g., 50) -phyType Type of physical layer  Phy/WirelessPhy -antType Type of antenna  Antenna/OmniAntenna -channelType Type of channel  Channel/WirelessChannel  Create a topology object: set topo [new Topography] Define the grid size: $topo load_flatgrid 500 500 Use the variable $topo as parameter for this option Description of the wireless -topoInstance network topology -agentTrace Flag to enable writing of trace data for agent module -routerTrace Flag to enable writing of trace data for wireless router module -macTrace Flag to enable writing of trace data for wireless MAC module Flag to enable writing of trace data for -movementTrace the movement of wireless nodes o NOTE:     ON OFF   ON OFF   ON OFF   ON OFF
  • 4. All default values for these options are NULL except: addressingType: flat Common values used in Wireless Simulation o A very common way to keep option values in a single place is to used an associative array (the indices of the array are names instead of numbers) o Here are some commonly used values for wireless simulations: # =========================================================== =========== # Define options # =========================================================== =========== set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radiopropagation model set val(ant) Antenna/OmniAntenna ;# Antenna type set val(ll) LL ;# Link layer type set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type set val(ifqlen) 50 ;# max packet in ifq set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(rp) DSDV ;# ad-hoc routing protocol o After storing the values in the associative array $val, we can set the options of wireless nodes as follows: # ================================================== # Configure nodes # ================================================== $ns_ node-config -channelType $val(chan) -propType $val(prop) -antType $val(ant) -llType $val(ll) -ifqType $val(ifq) -ifqLen $val(ifqlen) -phyType $val(netif)
  • 5. -macType $val(mac) -adhocRouting $val(rp) -agentTrace ON -routerTrace ON -macTrace OFF -movementTrace OFF -topoInstance $topo  Don't worry about the variable $topo, we will cover that later. Topology o The wireless simulation needs to know the area in which the wireless nodes can travel... o For this purpose, NS has defined a Topology class to store information about the mobile hosts that move in a grid... o The create a Topology object, use: set VARNAME [new Topography] EXAMPLE: set topo [new Topography] o To provide the topography object with x and y co-ordinates of the boundary, use: $TOPO_VARNAME load_flatgrid X-SIZE EXAMPLE: $topo  load_flatgrid 500 500 Default granularity is 1 The General Operations Director (GOD) Object Y-SIZE [Granularity]
  • 6. o o o o o Unlike wired (immobile) network simulation, the location of mobile hosts are not known when the simulation is in progress. In order to determine whether 2 mobile nodes can communicate with each other (i.e., whether they are within each others' range), NS needs to find out their locations. So NS must maintain some necessary information on ALL mobile hosts NS has defined a class to do so, and it is called "GOD" (General Operations Director) - the acronym "GOD" seems appropriate since this object knows information about every mobile hosts :-) Before you can create a mobile host, you MUST first create a "GOD" object, using the following command: create-god NUMBER-Of-Mobile-Nodes The parameter NUMBER-Of-Mobile-Nodes is the number of mobile hosts in the wireless simulation (you need to tell NS the amount of space to reserve) Some more information of the GOD class object:  o The GOD (General Operations Director) object is used to store global information about the state of the environment, network or nodes that an omniscent observer would have, but that should not be made known to any participant in the simulation. A GOD object stores the total number of mobile nodes and a table of shortest number of hops required to reach from one node to another. The next hop information is loaded into GOD object from movement pattern files, before simulation begins, since calculating this on the fly during simulation runs can be quite time consuming. o NOTE: Only ONE single global instance of the GOD object is to be created during an NS simulation !!! How to write a Wireless Simulation in NS o OK, we know enough to write a simple wireless simulation in NS
  • 7. o o Simulated Scenario: Simulation program: # simple-wireless.tcl # A simple example for wireless simulation # =========================================================== =========== # Define options # =========================================================== =========== set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 2 ;# number of mobilenodes set val(rp) DSDV ;# routing protocol # =========================================================== =========== # Main Program # =========================================================== =========== # # Initialize Global Variables # set ns_ [new Simulator] set tracefd [open simple.tr w] $ns_ trace-all $tracefd # ---------------------------------------------------------------# Set up wireless network simulation
  • 8. # ---------------------------------------------------------------# Create topography object to hold wireless scenario set topo [new Topography] $topo load_flatgrid 500 500 500x500 ;# Grid size is # # Create god object # create-god $val(nn) # # Create the specified number of mobilenodes [$val(nn)] and "attach" them # to the channel. # Here two nodes are created : node(0) and node(1) # configure node $ns_ node-config -adhocRouting $val(rp) -llType $val(ll) -macType $val(mac) -ifqType $val(ifq) -ifqLen $val(ifqlen) -antType $val(ant) -propType $val(prop) -phyType $val(netif) -channelType $val(chan) -topoInstance $topo -agentTrace ON -routerTrace ON -macTrace OFF -movementTrace OFF # -------------------------------------------------------# Direct mobile node's movements # -------------------------------------------------------for {set i 0} {$i< $val(nn) } {incri} { set node_($i) [$ns_ node] $node_($i) random-motion 0 random motion } ;# disable # # Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes # $node_(0) set X_ 5.0 $node_(0) set Y_ 2.0 $node_(0) set Z_ 0.0
  • 9. $node_(1) set X_ 390.0 $node_(1) set Y_ 385.0 $node_(1) set Z_ 0.0 # # Now produce some simple node movements # Node_(1) starts to move towards node_(0) # $ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0" $ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0" # Node_(1) then starts to move away from node_(0) $ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0" # -------------------------------------------------------------# The rest is "ordinary" network connection setup # -------------------------------------------------------------# Setup TCP connections between node_(0) and node_(1) set tcp [new Agent/TCP] $ns_ attach-agent $node_(0) $tcp $tcp set class_ 2 set sink [new Agent/TCPSink] $ns_ attach-agent $node_(1) $sink $ns_ connect $tcp $sink # Setup FTP flow for TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ns_ at 10.0 "$ftp start" # # Tell nodes when the simulation ends # for {set i 0} {$i< $val(nn) } {incri} { $ns_ at 150.0 "$node_($i) reset"; } $ns_ at 150.0 "stop" $ns_ at 150.01 "puts "NS EXITING..." ; $ns_ halt" proc stop {} { global ns_ tracefd $ns_ flush-trace close $tracefd } puts "Starting Simulation..."
  • 10. $ns_ run o Example Program: (Demo above code)  Prog file: click here Trace Information from Wireless Simulation o AgentTraces are marked with AGT in the 5th field o RouterTrace are marked with RTR in the 5th field o MacTrace are marked with MAC in the 5th fields. o MovementTrace (shows the movement of the mobile nodes) are marked with M in the 2nd field. References o Marc Greis' NS Tutorial Chapter IX. Running Wireless Simulations in ns - click here