SlideShare a Scribd company logo
1 of 43
NETWORK SIMULATOR
(NS-2)
By
S.BHASEERUNNISHA
bhaseer21@gmail.com
TRANSPORT LAYER
 Flow Control and Error Control
 Two transport protocols.
* Transmission Control Protocol (TCP)
* User Datagram Protocol (UDP)
SYSTEM MODELLING APPROACH
 Analytical Approach - describe the system
mathematically, and apply numerical methods.
 Simulating Approach - recreates real-world
scenarios using computer programs and
simulation usually requires fewer simplification
assumptions.
PARTS OF GENERAL SIMULATION IN
COMPUTER NETWORKS
1. Planning
2. Implementing
a) Initialization
b) Result Generation
c) Post simulation Processing
3. Testing
SIMULATION PERFORMANCE
 Execution Speed
 Cost
 Fidelity
 Repeatability
 Scalability
EXAMPLES OF SIMULATION TOOL
The following are some of the widely used network
simulation tools:
• NS2
• GloMoSim
• QualNet
• Opnet
• MATLAB
SIMULATION TYPES
A. Time-Driven Simulation
B. Event-Driven Simulation
NS2
 NS2-Network Simulator (Version 2), widely known as
NS2, is simply an event-driven simulation tool that has
proved useful in studying the dynamic nature of
communication networks. Simulation of wired as well as
wireless network functions and protocols (e.g., routing
algorithms, TCP, UDP) can be done using NS2.
NS2 –TWO KEY LANGUAGES
 C++ - The internal mechanism (i.e., a backend) of the simulation
 Object-Oriented Tool Command Language (OTcL) - Sets up
simulation by assembling and configuring the objects as well as
scheduling discrete events (i.e., a frontend)
C++ and OTcL are linked together using TclCL
NS2 VISUALIZATION TOOL (NAM)
NS2 ANALYSIS TOOL (XGRAPH)
INSTALLATION OF NS2
 NS2 builds and runs under windows using Cygwin.
Cygwin provides Linux like environment under
windows.
 Download Cygwin from following link
http://www.cygwin.com/setup.exe
TERMINOLOGIES
1. The complied hierarchies
2. The Interpreted hierarchies
3. Upstream Object
4. Downstream Object
BASIC OF TCL
BASIC OPERATIONS
 Assignment: set <name> <value>
(e.g., set x 0)
 Deassignment: unset <name>
(e.g., unset x)
 Input: gets <channel> [<varname>]
(e.g., gets x)
 Output: puts [-nonewline] [<channel>] <str>
(e.g., puts $x)
 Error reporting: error <str>
(e.g., error "Fatal Error!!")
LOGICAL AND MATHEMATICAL OPERATIONS
Logical statement:
A <ops> B
operators <ops> is given below.
 < (less than) = (equal)
 <= (less than or equal) != (Not Equal)
 > (greater than) || (OR)
 >= (greater than or equal) && (AND)
 ! (negation)
Increment:
incr <varName> [<incrVal>]
Arithmetic operation:
expr A <ops> B
 Basic arithmetic operators <ops> are given below:
+ (addition) - (subtraction) * (multiplication)
/ (division) % (modulo)
 The advanced arithmetic operators <ops> are
shown below:
& (bitwise AND) | (bitwise OR)
<< (left shift) >> (right shift)
x?y:z (If x is nonzero, then y. Otherwise, z)
Mathematical function:
expr <fn>([<args>])
Mathematical functions <fn> are defined below:
abs(x) cosh(x) log(x) sqrt(x) acos(x) double(x)
log10(x) srand(x) asin(x) exp(x) pow(x,y)
tan(x) atan(x) floor(x) rand(x) tanh(x)
atan2(x) fmod(x) round(x) wide(x) ceil(x)
hypot(x,y) sin(x) cos(x) int(x) sinh(x)
CONTROL STRUCTURE
Selection Structure
if.. else, elseif ,and switch are the selection
structure.
Their syntaxes are shown below:
if {<condition1>} { <actionSet1> }
elseif {<condition2>} { <actionSet2> }
...
else { <actionSetN> }
switch <variable> {
<pattern_1> { <actionSet1> }
<pattern_2> { <actionSet2> }
...
default { <actionSetN> }
}
Repetition Structure
The commands “while,” “for,” and “foreach” are
used when actions need to be repeated for several
times.
 while {<condition>} { <actions> }
 for {<init>} {<condition>} {<mod>} { <actions> }
 foreach {<var>} {<list>} { <actions> }
Jumping Structure
The structure “break” and “continue” are used
to stop the iterative flow of the above “while,” “for,”
and “foreach” repetitive structures.
Packet tracing- records the detail of packet flow during a
simulation.
Packet tracing can be classified based on
1. Text Based Packet Tracing
2. NAM Packet Tracing
Text Based Packet Tracing
Text-based packet tracing records the detail of packets
passing through network checkpoints (e.g., nodes and queues).
it is invoked by
>>$ns trace-all $file
Network AniMation (NAM) Packet Tracing
Many visualization features are available in
NAM. These features are for example animating
colored packet flows, dragging and dropping nodes
(positioning), labeling nodes at a specified instant,
shaping the nodes, coloring a specific link, and
monitoring a queue.
It is Invoked by
>>nam filename.nam
EXAMPLE
# myfirst_ns.tcl
# Create a Simulator
1 set ns [new Simulator]
# Create a trace file
2 set mytrace [open out.tr w]
3 $ns trace-all $mytrace
# Create a NAM trace file
4 set myNAM [open out.nam w]
5 $ns namtrace-all $myNAM
# Define a procedure finish
6 proc finish { } {
7 global ns mytrace myNAM
8 $ns flush-trace
9 close $mytrace
10 close $myNAM
11 exec nam out.nam &
12 exit 0
13 }
# Create Nodes
14 set n0 [$ns node]
15 set n1 [$ns node]
16 set n2 [$ns node]
17 set n3 [$ns node]
18 set n4 [$ns node]
# Connect Nodes with Links
19 $ns duplex-link $n0 $n2 100Mb 5ms DropTail
20 $ns duplex-link $n1 $n2 100Mb 5ms DropTail
21 $ns duplex-link $n2 $n4 54Mb 10ms DropTail
22 $ns duplex-link $n2 $n3 54Mb 10ms DropTail
23 $ns simplex-link $n3 $n4 10Mb 15ms DropTail
24 $ns queue-limit $n2 $n3 40
# Create a UDP agent
25 set udp [new Agent/UDP]
26 $ns attach-agent $n0 $udp
27 set null [new Agent/Null]
28 $ns attach-agent $n3 $null
29 $ns connect $udp $null
30 $udp set fid_ 1
# Create a CBR traffic source
31 set cbr [new Application/Traffic/CBR]
32 $cbr attach-agent $udp
33 $cbr set packetSize_ 1000
34 $cbr set rate_ 2Mb
# Create a TCP agent
35 set tcp [new Agent/TCP]
36 $ns attach-agent $n1 $tcp
37 set sink [new Agent/TCPSink]
38 $ns attach-agent $n4 $sink
39 $ns connect $tcp $sink
40 $tcp set fid_ 2
# Create an FTP session
41 set ftp [new Application/FTP]
42 $ftp attach-agent $tcp
# Schedule events
43 $ns at 0.05 "$ftp start"
44 $ns at 0.1 "$cbr start"
45 $ns at 60.0 "$ftp stop"
46 $ns at 60.5 "$cbr stop"
47 $ns at 61 "finish“
# Start the simulation
48 $ns run
We run the above simulation script by executing
>>ns myfirst_ns.tcl
The Text-Based Packet Tracing for the example
“myfirst_ns.tcl” is
...
+ 0.110419 1 2 tcp 1040 ------- 2 1.0 4.0 5 12
+ 0.110419 1 2 tcp 1040 ------- 2 1.0 4.0 6 13
r 0.115348 1 2 tcp 1040 ------- 2 1.0 4.0 3 10
+ 0.115348 2 4 tcp 1040 ------- 2 4.0 4.0 3 10
- 0.115348 2 4 tcp 1040 ------- 2 4.0 2.0 3 10
r 0.115376 2 3 cbr 1000 ------- 1 4.0 3.0 1 7
r 0.115431 1 2 tcp 1040 ------- 2 1.0 4.0 4 11
...
Format of each line in normal Trace line
SUMMARY
 Transport Layer
 Modeling Approach
 Parts of Simulation
 Simulation Performance
 Simulation Types
 NS2
 Installation of NS2
 Terminologies
 Basics of TcL
 Packet Tracing
 Example
~Ns2~
~Ns2~

More Related Content

What's hot

Power Saving in Wireless Sensor Networks
Power Saving in Wireless Sensor NetworksPower Saving in Wireless Sensor Networks
Power Saving in Wireless Sensor NetworksMshari Alabdulkarim
 
WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...
WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...
WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...ArunChokkalingam
 
WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts – ...
WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts –  ...WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts –  ...
WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts – ...ArunChokkalingam
 
Sensor node hardware and network architecture
Sensor node hardware and network architectureSensor node hardware and network architecture
Sensor node hardware and network architectureVidhi603146
 
SENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLSSENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLSjuno susi
 
Sensor networks
Sensor networksSensor networks
Sensor networksMarc Pous
 
Building Topology in NS3
Building Topology in NS3Building Topology in NS3
Building Topology in NS3Rahul Hada
 
Delay Tolerant Network (DTN)
Delay Tolerant Network (DTN)Delay Tolerant Network (DTN)
Delay Tolerant Network (DTN)Haya Saani
 
Wireless sensor network applications
Wireless sensor network applicationsWireless sensor network applications
Wireless sensor network applicationsDeepshika Reddy
 
Routing Protocols for Wireless Sensor Networks
Routing Protocols for Wireless Sensor NetworksRouting Protocols for Wireless Sensor Networks
Routing Protocols for Wireless Sensor NetworksDarpan Dekivadiya
 
QoS (quality of service)
QoS (quality of service)QoS (quality of service)
QoS (quality of service)Sri Safrina
 
Intoduction to TinyOS, nesC and TOSSIM
Intoduction to TinyOS, nesC and TOSSIMIntoduction to TinyOS, nesC and TOSSIM
Intoduction to TinyOS, nesC and TOSSIMPrakhar Bansal
 
Localization in WSN
Localization in WSNLocalization in WSN
Localization in WSNYara Ali
 

What's hot (20)

Delay telerant network
Delay telerant networkDelay telerant network
Delay telerant network
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Power Saving in Wireless Sensor Networks
Power Saving in Wireless Sensor NetworksPower Saving in Wireless Sensor Networks
Power Saving in Wireless Sensor Networks
 
Clocks
ClocksClocks
Clocks
 
Data dissemination
Data disseminationData dissemination
Data dissemination
 
WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...
WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...
WSN network architecture -Sensor Network Scenarios & Transceiver Design Consi...
 
WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts – ...
WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts –  ...WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts –  ...
WSN NETWORK -MAC PROTOCOLS - Low Duty Cycle Protocols And Wakeup Concepts – ...
 
Sensor node hardware and network architecture
Sensor node hardware and network architectureSensor node hardware and network architecture
Sensor node hardware and network architecture
 
Nesc tutorial
Nesc tutorialNesc tutorial
Nesc tutorial
 
SENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLSSENSOR NETWORK PLATFORMS AND TOOLS
SENSOR NETWORK PLATFORMS AND TOOLS
 
Sensor networks
Sensor networksSensor networks
Sensor networks
 
Building Topology in NS3
Building Topology in NS3Building Topology in NS3
Building Topology in NS3
 
Delay Tolerant Network (DTN)
Delay Tolerant Network (DTN)Delay Tolerant Network (DTN)
Delay Tolerant Network (DTN)
 
Wireless sensor network applications
Wireless sensor network applicationsWireless sensor network applications
Wireless sensor network applications
 
ns-3 Tutorial
ns-3 Tutorialns-3 Tutorial
ns-3 Tutorial
 
Routing Protocols for Wireless Sensor Networks
Routing Protocols for Wireless Sensor NetworksRouting Protocols for Wireless Sensor Networks
Routing Protocols for Wireless Sensor Networks
 
QoS (quality of service)
QoS (quality of service)QoS (quality of service)
QoS (quality of service)
 
Intoduction to TinyOS, nesC and TOSSIM
Intoduction to TinyOS, nesC and TOSSIMIntoduction to TinyOS, nesC and TOSSIM
Intoduction to TinyOS, nesC and TOSSIM
 
Routing Protocols
Routing ProtocolsRouting Protocols
Routing Protocols
 
Localization in WSN
Localization in WSNLocalization in WSN
Localization in WSN
 

Viewers also liked

ns-3: History and Future
ns-3: History and Futurens-3: History and Future
ns-3: History and Futuremathieu_lacage
 
Introduction to NS2 - Cont..
Introduction to NS2 - Cont..Introduction to NS2 - Cont..
Introduction to NS2 - Cont..cscarcas
 
Transport layer
Transport layerTransport layer
Transport layersteffy1996
 
Computer network
Computer network Computer network
Computer network Shreya Shah
 
Mobile computing-tcp data flow control
Mobile computing-tcp data flow controlMobile computing-tcp data flow control
Mobile computing-tcp data flow controlSushant Kushwaha
 
Network Simulation NS3
Network Simulation NS3Network Simulation NS3
Network Simulation NS3baddi youssef
 
NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING
NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING
NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING Anu Bhatt
 
Flow control in computer
Flow control in computerFlow control in computer
Flow control in computerrud_d_rcks
 
Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...
Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...
Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...Bikash Chandra Prusty
 
Use of NS-2 to Simulate MANET Routing Algorithms
Use of NS-2 to Simulate MANET Routing AlgorithmsUse of NS-2 to Simulate MANET Routing Algorithms
Use of NS-2 to Simulate MANET Routing AlgorithmsGiancarlo Romeo
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesTeerawat Issariyakul
 

Viewers also liked (20)

Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
 
ns-3: History and Future
ns-3: History and Futurens-3: History and Future
ns-3: History and Future
 
Session 1 introduction to ns2
Session 1   introduction to ns2Session 1   introduction to ns2
Session 1 introduction to ns2
 
Introduction to NS2 - Cont..
Introduction to NS2 - Cont..Introduction to NS2 - Cont..
Introduction to NS2 - Cont..
 
Transport layer
Transport layerTransport layer
Transport layer
 
Cryptography
CryptographyCryptography
Cryptography
 
TinyOS 2.1 Tutorial: TOSSIM
TinyOS 2.1 Tutorial: TOSSIMTinyOS 2.1 Tutorial: TOSSIM
TinyOS 2.1 Tutorial: TOSSIM
 
Computer network
Computer network Computer network
Computer network
 
Security and Cryptography
Security and CryptographySecurity and Cryptography
Security and Cryptography
 
Mobile computing-tcp data flow control
Mobile computing-tcp data flow controlMobile computing-tcp data flow control
Mobile computing-tcp data flow control
 
Network Simulation NS3
Network Simulation NS3Network Simulation NS3
Network Simulation NS3
 
NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING
NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING
NUMERICAL & STATISTICAL METHODS FOR COMPUTER ENGINEERING
 
Flow control in computer
Flow control in computerFlow control in computer
Flow control in computer
 
Ns2
Ns2Ns2
Ns2
 
Leach & Pegasis
Leach & PegasisLeach & Pegasis
Leach & Pegasis
 
NS2: Events and Handlers
NS2: Events and HandlersNS2: Events and Handlers
NS2: Events and Handlers
 
Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...
Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...
Dual Layer Security Of Data Using LSB Image Steganography And AES Encryption ...
 
NS2--Event Scheduler
NS2--Event SchedulerNS2--Event Scheduler
NS2--Event Scheduler
 
Use of NS-2 to Simulate MANET Routing Algorithms
Use of NS-2 to Simulate MANET Routing AlgorithmsUse of NS-2 to Simulate MANET Routing Algorithms
Use of NS-2 to Simulate MANET Routing Algorithms
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
 

Similar to ~Ns2~ (20)

Ns 2 Network Simulator An Introduction
Ns 2 Network Simulator An IntroductionNs 2 Network Simulator An Introduction
Ns 2 Network Simulator An Introduction
 
Venkat ns2
Venkat ns2Venkat ns2
Venkat ns2
 
NS2-tutorial.pdf
NS2-tutorial.pdfNS2-tutorial.pdf
NS2-tutorial.pdf
 
NS2-tutorial.ppt
NS2-tutorial.pptNS2-tutorial.ppt
NS2-tutorial.ppt
 
Ns network simulator
Ns network simulatorNs network simulator
Ns network simulator
 
Ns2 ns3 training in mohali
Ns2 ns3 training in mohaliNs2 ns3 training in mohali
Ns2 ns3 training in mohali
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Network Simulator Tutorial
Network Simulator TutorialNetwork Simulator Tutorial
Network Simulator Tutorial
 
Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
 
Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
 
Ns2 introduction 2
Ns2 introduction 2Ns2 introduction 2
Ns2 introduction 2
 
Tut hemant ns2
Tut hemant ns2Tut hemant ns2
Tut hemant ns2
 
Working with NS2
Working with NS2Working with NS2
Working with NS2
 
cscn1819.pdf
cscn1819.pdfcscn1819.pdf
cscn1819.pdf
 
Ns tutorial
Ns tutorialNs tutorial
Ns tutorial
 
Ns2
Ns2Ns2
Ns2
 
Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
 
ns2-lecture.ppt
ns2-lecture.pptns2-lecture.ppt
ns2-lecture.ppt
 
Ns2
Ns2Ns2
Ns2
 
Ns fundamentals 1
Ns fundamentals 1Ns fundamentals 1
Ns fundamentals 1
 

Recently uploaded

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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 

Recently uploaded (20)

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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
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
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
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
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 

~Ns2~

  • 2. TRANSPORT LAYER  Flow Control and Error Control  Two transport protocols. * Transmission Control Protocol (TCP) * User Datagram Protocol (UDP)
  • 3. SYSTEM MODELLING APPROACH  Analytical Approach - describe the system mathematically, and apply numerical methods.  Simulating Approach - recreates real-world scenarios using computer programs and simulation usually requires fewer simplification assumptions.
  • 4. PARTS OF GENERAL SIMULATION IN COMPUTER NETWORKS 1. Planning 2. Implementing a) Initialization b) Result Generation c) Post simulation Processing 3. Testing
  • 5. SIMULATION PERFORMANCE  Execution Speed  Cost  Fidelity  Repeatability  Scalability
  • 6. EXAMPLES OF SIMULATION TOOL The following are some of the widely used network simulation tools: • NS2 • GloMoSim • QualNet • Opnet • MATLAB
  • 7. SIMULATION TYPES A. Time-Driven Simulation B. Event-Driven Simulation
  • 8. NS2  NS2-Network Simulator (Version 2), widely known as NS2, is simply an event-driven simulation tool that has proved useful in studying the dynamic nature of communication networks. Simulation of wired as well as wireless network functions and protocols (e.g., routing algorithms, TCP, UDP) can be done using NS2.
  • 9. NS2 –TWO KEY LANGUAGES  C++ - The internal mechanism (i.e., a backend) of the simulation  Object-Oriented Tool Command Language (OTcL) - Sets up simulation by assembling and configuring the objects as well as scheduling discrete events (i.e., a frontend) C++ and OTcL are linked together using TclCL
  • 11. NS2 ANALYSIS TOOL (XGRAPH)
  • 12. INSTALLATION OF NS2  NS2 builds and runs under windows using Cygwin. Cygwin provides Linux like environment under windows.  Download Cygwin from following link http://www.cygwin.com/setup.exe
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22. TERMINOLOGIES 1. The complied hierarchies 2. The Interpreted hierarchies 3. Upstream Object 4. Downstream Object
  • 24. BASIC OPERATIONS  Assignment: set <name> <value> (e.g., set x 0)  Deassignment: unset <name> (e.g., unset x)  Input: gets <channel> [<varname>] (e.g., gets x)  Output: puts [-nonewline] [<channel>] <str> (e.g., puts $x)  Error reporting: error <str> (e.g., error "Fatal Error!!")
  • 25. LOGICAL AND MATHEMATICAL OPERATIONS Logical statement: A <ops> B operators <ops> is given below.  < (less than) = (equal)  <= (less than or equal) != (Not Equal)  > (greater than) || (OR)  >= (greater than or equal) && (AND)  ! (negation)
  • 26. Increment: incr <varName> [<incrVal>] Arithmetic operation: expr A <ops> B  Basic arithmetic operators <ops> are given below: + (addition) - (subtraction) * (multiplication) / (division) % (modulo)  The advanced arithmetic operators <ops> are shown below: & (bitwise AND) | (bitwise OR) << (left shift) >> (right shift) x?y:z (If x is nonzero, then y. Otherwise, z)
  • 27. Mathematical function: expr <fn>([<args>]) Mathematical functions <fn> are defined below: abs(x) cosh(x) log(x) sqrt(x) acos(x) double(x) log10(x) srand(x) asin(x) exp(x) pow(x,y) tan(x) atan(x) floor(x) rand(x) tanh(x) atan2(x) fmod(x) round(x) wide(x) ceil(x) hypot(x,y) sin(x) cos(x) int(x) sinh(x)
  • 28. CONTROL STRUCTURE Selection Structure if.. else, elseif ,and switch are the selection structure. Their syntaxes are shown below: if {<condition1>} { <actionSet1> } elseif {<condition2>} { <actionSet2> } ... else { <actionSetN> } switch <variable> { <pattern_1> { <actionSet1> } <pattern_2> { <actionSet2> } ... default { <actionSetN> } }
  • 29. Repetition Structure The commands “while,” “for,” and “foreach” are used when actions need to be repeated for several times.  while {<condition>} { <actions> }  for {<init>} {<condition>} {<mod>} { <actions> }  foreach {<var>} {<list>} { <actions> }
  • 30. Jumping Structure The structure “break” and “continue” are used to stop the iterative flow of the above “while,” “for,” and “foreach” repetitive structures.
  • 31. Packet tracing- records the detail of packet flow during a simulation. Packet tracing can be classified based on 1. Text Based Packet Tracing 2. NAM Packet Tracing Text Based Packet Tracing Text-based packet tracing records the detail of packets passing through network checkpoints (e.g., nodes and queues). it is invoked by >>$ns trace-all $file
  • 32. Network AniMation (NAM) Packet Tracing Many visualization features are available in NAM. These features are for example animating colored packet flows, dragging and dropping nodes (positioning), labeling nodes at a specified instant, shaping the nodes, coloring a specific link, and monitoring a queue. It is Invoked by >>nam filename.nam
  • 33. EXAMPLE # myfirst_ns.tcl # Create a Simulator 1 set ns [new Simulator] # Create a trace file 2 set mytrace [open out.tr w] 3 $ns trace-all $mytrace # Create a NAM trace file 4 set myNAM [open out.nam w] 5 $ns namtrace-all $myNAM
  • 34. # Define a procedure finish 6 proc finish { } { 7 global ns mytrace myNAM 8 $ns flush-trace 9 close $mytrace 10 close $myNAM 11 exec nam out.nam & 12 exit 0 13 }
  • 35. # Create Nodes 14 set n0 [$ns node] 15 set n1 [$ns node] 16 set n2 [$ns node] 17 set n3 [$ns node] 18 set n4 [$ns node] # Connect Nodes with Links 19 $ns duplex-link $n0 $n2 100Mb 5ms DropTail 20 $ns duplex-link $n1 $n2 100Mb 5ms DropTail 21 $ns duplex-link $n2 $n4 54Mb 10ms DropTail 22 $ns duplex-link $n2 $n3 54Mb 10ms DropTail 23 $ns simplex-link $n3 $n4 10Mb 15ms DropTail 24 $ns queue-limit $n2 $n3 40
  • 36. # Create a UDP agent 25 set udp [new Agent/UDP] 26 $ns attach-agent $n0 $udp 27 set null [new Agent/Null] 28 $ns attach-agent $n3 $null 29 $ns connect $udp $null 30 $udp set fid_ 1 # Create a CBR traffic source 31 set cbr [new Application/Traffic/CBR] 32 $cbr attach-agent $udp 33 $cbr set packetSize_ 1000 34 $cbr set rate_ 2Mb
  • 37. # Create a TCP agent 35 set tcp [new Agent/TCP] 36 $ns attach-agent $n1 $tcp 37 set sink [new Agent/TCPSink] 38 $ns attach-agent $n4 $sink 39 $ns connect $tcp $sink 40 $tcp set fid_ 2 # Create an FTP session 41 set ftp [new Application/FTP] 42 $ftp attach-agent $tcp
  • 38. # Schedule events 43 $ns at 0.05 "$ftp start" 44 $ns at 0.1 "$cbr start" 45 $ns at 60.0 "$ftp stop" 46 $ns at 60.5 "$cbr stop" 47 $ns at 61 "finish“ # Start the simulation 48 $ns run We run the above simulation script by executing >>ns myfirst_ns.tcl
  • 39. The Text-Based Packet Tracing for the example “myfirst_ns.tcl” is ... + 0.110419 1 2 tcp 1040 ------- 2 1.0 4.0 5 12 + 0.110419 1 2 tcp 1040 ------- 2 1.0 4.0 6 13 r 0.115348 1 2 tcp 1040 ------- 2 1.0 4.0 3 10 + 0.115348 2 4 tcp 1040 ------- 2 4.0 4.0 3 10 - 0.115348 2 4 tcp 1040 ------- 2 4.0 2.0 3 10 r 0.115376 2 3 cbr 1000 ------- 1 4.0 3.0 1 7 r 0.115431 1 2 tcp 1040 ------- 2 1.0 4.0 4 11 ... Format of each line in normal Trace line
  • 40.
  • 41. SUMMARY  Transport Layer  Modeling Approach  Parts of Simulation  Simulation Performance  Simulation Types  NS2  Installation of NS2  Terminologies  Basics of TcL  Packet Tracing  Example