Transcript VI. Matlab
NS-2 Training
12/08/2014
Introduction
NS-2: Network Simulator Generation 2
Latest Release: 2.35 / Nov. 4, 2011
http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/
Other Simulators
OPNET
QualNet
ns-3
Installation (1/2)
Cygwin
Linux-like environment for Windows
Download
http://140.116.72.80/~smallko/ns2/cygwin.rar
http://www.cygwin.com/
NS-2
The latest version: ns-2.35
ns-allinone-2.28/2.29
Download
http://sourceforge.net/projects/nsnam/files/allinone/
http://140.116.72.80/~smallko/ns2/ns-allinone-2.28.rar
Installation (2/2)
Nam: Network Animator (nam-1.15 released Nov 4 2011)
animation tool for viewing network simulation traces and real
world packet traces
http://www.isi.edu/nsnam/nam/index.html
TCL Codes
TCL (Tool Command Language)
pronounced as "tickle"
Basic terms
Create a new simulator
Definitions for nam
Open a trace file
Network behaviors
• Initialize the packet format
• Create a scheduler
• Select the default address format
• /ns-2.xx/tcl/lib/ns-lib.tcl
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf
set nd [open out.tr w]
$ns trace-all $nd
Nodes, links, queue size, node position, traffic types, simulation times,
etc.
Example
Output data
NAM
Trace
• appeared as "------" since no flag is set
• Explicit Congestion Notification
Analysis
AWK
Alfred Aho, Peter Weinberger, and Brian Kernighan
programming language that is designed for processing textbased data
pronounced as the same as the name of the bird, “auk”
Run AWK file
Commands
awk -f file1.awk file2.tr
awk -f file1.awk file2.tr > out.txt
file1.awk
file2.tr
a command file
a primary input file
out.txt
an output file
AWK
Form
/pattern/ { action }
Pattern is typically an expression
Action is a series of commands
In NS-2 Simulator
BEGIN { action }
END { action }
AWK
You can measure
Delay, Jitter, Packet loss, and Throughput
Example
NSG2
NSG2
NSG2
http://sites.google.com/site/pengjungwu/nsg
JAVA6.0
http://java.sun.com/
Creative Intelligence Information System Lab,
Department of Computer Science and Engineering,
National Sun Yat-sen University
Resources
Gunplot
Plot the analyzed results of awk
Web site
NS2 使用說明手冊
NS-2 Trace Formats
http://hpds.ee.ncku.edu.tw/~smallko/ns2/ns2.htm
http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats
Books
計算機網路實驗—以NS2模擬工具實作,柯志亨
計算機網路實驗—使用NS2模擬多媒體通訊與無線網路,
柯志亨團隊