Download presentation
Presentation is loading. Please wait.
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 Therefore simulator!
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 NAM – Network AniMator
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 C++ objects Pure OTcl 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 > 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 something's burning!
11
A simulation Instantiate a simulator object Create nodes links
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 Mark Greis’ tutorial ns manual
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.