Todo

Solo disponible en BuenasTareas
  • Páginas : 3 (686 palabras )
  • Descarga(s) : 0
  • Publicado : 2 de marzo de 2011
Leer documento completo
Vista previa del texto
Sandeep Gupta

A brief guide to NS-2

Topics
Introduction Writing scripts Writing wireless scripts Post simulation analysis
NAM Tracegraph
¡   ¡        

Useful links

Introduction
“NS(version 2) is an objectoriented, discrete event driven network simulator written in C++ and Otcl”

Tracegraph

Topics
Introduction Writing scripts Writing wireless scripts Post simulationanalysis
NAM Tracegraph
¡   ¡        

Useful links

Writing Scripts
'example1.tcl'

Creating a simulator object
set ns [new Simulator]

Open file for writing trace data
set nf [open out.namw] $ns namtrace-all $nf set f [open out.tr w] $ns trace-all $f

Add procedure finish
proc finish {} { global ns nf f $ns flush-trace close $nf close $f exec nam out.nam & exit 0}

WritingScripts
'example1.tcl'

When to call procedure finish
$ns at 5.0 "finish"

Start simulation
$ns run

Adding nodes
set n0 [$ns node] set n1 [$ns node]

Connect two nodes
$ns duplex-link $n0 $n11Mb 10ms DropTail

Writing Scripts
'example1.tcl'

Writing Scripts
'example1.tcl'

Adding agents and traffic source
set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 set cbr0 [newApplication/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 set null0 [new Agent/Null] $ns attach-agent $n1 $null0 $ns connect $udp0 $null0 $ns at 0.5 "$cbr0 start"$ns at 4.5 "$cbr0 stop"

Writing Scripts
'example1.tcl'

Topics
Introduction Writing scripts Writing wireless scripts Post simulation analysis
NAM Tracegraph
¡   ¡        

Useful links Writing Wireless Scripts
'example2.tcl'

Defining wireless options
set val(chan) set val(prop) model set val(ant) set val(ll) set val(ifq) set val(ifqlen) set val(netif) set val(mac) set val(rp)set val(nn) Channel/WirelessChannel ;# channel type

Propagation/TwoRayGround ;# radio-propagation Antenna/OmniAntenna LL ;# Antenna type ;# Link layer type

Queue/DropTail/PriQueue ;#...
tracking img