1 / 12

Introduction to NS

Introduction to NS. Srinath Perur. This introduction…. Why NS NS and NAM Basic Tcl Basic OTcl Organization of a simulation Demos of wired and wireless simulations. Why NS?. Preliminary testing/validation in field Time, effort, money Internet scale testing

jarah
Télécharger la présentation

Introduction to NS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to NS Srinath Perur

  2. This introduction… • Why NS • NS and NAM • Basic Tcl • Basic OTcl • Organization of a simulation • Demos of wired and wireless simulations

  3. Why NS? • Preliminary testing/validation in field • Time, effort, money • Internet scale testing • Mobile computing – hardware, etc. • Slow to modify Therefore simulator! • NS • Easily available • Widely accepted

  4. NS and NAM • NS – Network Simulator • Event driven simulator • Implemented in C++ • OTcl for command and configuration interface • NAM – Network AniMator • Graphical representation of NS output

  5. C++ and OTcl Separation • C++ for “data” • Per packet action • OTcl for control • Periodic or triggered action • Compromise between composibility and speed • Learning and debugging

  6. OTcl and C++: The Duality Pure OTcl objects Pure C++ objects C++/OTcl split objects C++ OTcl ns

  7. Basic Tcl %ns > puts “Hello!” > Hello! >set a 5 > set b 4 >set c [expr $a + $b] >puts “The sum of $a and $b is $c”

  8. Basic Tcl >proc print_list {list}{ set count 0 foreach element $list { incr count puts $element } return $count } >set list1 {a, b, c} > set num_elements [print_list $list]

  9. Basic OTcl > Class Bun > set abun [new Bun] abun > $abun info class Bun > Bun info instances abun > Bun instproc init {args} { $self instvar toasted set toasted 0 eval $self next $args }

  10. Basic OTcl > Bun instproc toast {} { $self instvar toasted incr toasted if {$toasted>1} then { error "something's burning!" } return {} } > $abun toast > $abun toast something's burning!

  11. A simulation • Instantiate a simulator object • set global properties for simulation • Create nodes • create agents at nodes, set their properties • links • connecting nodes, set their properties

  12. References • ns web pages • http://www.isi.edu/nsnam/ns/ • Mark Greis’ tutorial • recommended for starting • ns manual • ns workshop slides • ns mailing list archive • OTcl tutorial • Look at IT-605/IT-644 resources page

More Related