Professional Documents
Culture Documents
Noun Choi
Oct. 11, 2007
Outline
Background
ns-2 Internals
Short demo
Troubleshooting
Reference links
Q&A
Platforms
Most UNIX and UNIX-like systems
- FreeBSD or *BSD
- Linux
- Sun Solaris
- HP, SGI
WINDOWS
Under Cygwin
Components of ns-2
Installation
Latest version: 2.31 (Mar 10, 2007)
Download ns-allinone
http://www.isi.edu/nsnam/ns/ns-build.html#allin
one
What is ns-2
Unreliable
Real Object
Oriented?
Hard to troubleshoot
Unrealistic abstraction
C++
otcl
OTcl Linkage
set tcp [new Agent/TCP]
Agent/TCP
init
Agent
init
TclObject
Create C++
object
Create Otcl
shadow object
OTcl
TclObject
(C++)
constructor
parent
constructor
TcpAgent
constructor
C++
C++
int Agent::command(int argc, const char*const* argv)
{
if (argc == 3) {
if (strcmp(argv[1], advance") == 0) {
int newswq = atoi(argv[2]);
return (TCL_OK);
}
}
return (Agent::command(argc, argv);
}
Otcl
$tcp set window_ 200
Buffer
Target object
Event (Packet)
Time
Deque
Dispatch
Object A
Scheduler
Dispatch
Object B
An Example
A
CBR
CBR Sink
Transport
Transport
Network
Network
LL
LL
IFQ
Scheduler
IFQ
MAC
MAC
NetIF
NetIF
Wireless Channel
Demonstration
MobileNode
Wireless
Wired
Wired
BaseStation
MobileNode
MobileNode
Demonstration (Contd.)
set opt(chan)
Channel/WirelessChannel
;# channel type
set opt(prop)
Propagation/TwoRayGround
;# radio-propagation model
set opt(netif)
Phy/WirelessPhy
;# network interface type
set opt(mac)
Mac/802_11
;# MAC type
set opt(ifq)
Queue/DropTail/PriQueue
;# interface queue type
set opt(ll)
LL
;# link layer type
set opt(ant)
Antenna/OmniAntenna
;# antenna model
set opt(ifqlen)
50
;# max packet in ifq
set opt(adhocRouting)
DSDV
;# routing protocol
set opt(cp)
set opt(sc)
set opt(x)
670
set opt(y)
670
set opt(seed) 0.0
set opt(stop) 250
set opt(ftp1-start)
set opt(ftp2-start)
set num_wired_nodes
set num_bs_nodes
""
"./scen/scen-3-test"
100
150
2
1
Demonstration (Contd.)
#
================================================================
# accpet input parameter
set opt(nn)
[lindex $argv 0]
set outfile_ [lindex $argv 1]
#
================================================================
# check for boundary parameters and random seed
if { $opt(x) == 0 || $opt(y) == 0 } {
puts "No X-Y boundary values given for wireless topology\n"
}
if {$opt(seed) > 0} {
puts "Seeding Random number generator with $opt(seed)\n"
ns-random $opt(seed)
}
Demonstration (Contd.)
Demonstration (Contd.)
# define topology
$topo load_flatgrid $opt(x) $opt(y)
# create God
create-god [expr $opt(nn) + $num_bs_nodes]
Demonstration (Contd.)
Demonstration (Contd.)
Demonstration (Contd.)
Demonstration (Contd.)
Abbreviation
Type
Value
%g %d %d %s %d %s %d %d.%d %d.%d %d
%d
Normal Event
r: Receive
d: Drop
e: Error
+: Enque
-: Deque
double
Time
Int
Source Node
int
Destination Node
string
Packet Name
int
Packet Size
string
Flags
Int
Flow ID
Int
Source Address
Int
Destination Address
Int
Sequence Number
Int
Unique Packet ID
Troubleshooting
Problem while installing
Compiler may complain
http://www.isi.edu/nsnam/ns/ns-problems.html
Program crashes
Use gdb
Unexpected results
Hidden problem
Slice & dice the trace log
Reference Links
http://www.isi.edu/nsnam/ns/
Manual & Tutorial
http://www.isi.edu/nsnam/ns/ns-documentation.html
http://www.isi.edu/nsnam/ns/tutorial/index.html
http://www-sop.inria.fr/maestro/personnel/Eitan.Altman/COURS-NS/n3.p
df
Mailing List
http://www.isi.edu/nsnam/ns/ns-lists.html
Tcl
http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
OTcl
http://bmrc.berkeley.edu/research/cmt/cmtdoc/otcl/tutorial.html
tclCL
http://www.openmash.org/lxr/source/tclcl/tclcl.tcl?c=tutorials