VI. Matlab

advertisement
NS-2 Training
4/12/2011
Introduction

NS-2: Network Simulator Generation 2


Stable Release: 2.34 / June 17, 2009
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.34
ns-allinone-2.28/2.29
Download


http://sourceforge.net/projects/nsnam/files/
http://140.116.72.80/~smallko/ns2/ns-allinone-2.28.rar
Installation (2/2)

Nam: Network Animator (nam-1.14 released Jun 17 2009)


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.
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
Rests of this project

WiMAX module

http://140.116.72.80/~smallko/ns2/ns-allinone-2.29_wimax.rar

長庚大學

Install cygwin first and then download this file. Decompress it. After that,
run “./configure; make clean; make depend; make”

ns-allinone-2.29_wimax\ns-2.29\mac\802_16\traffic
Rests of this project

MPEG








modify the file packet.h in the common folder (Line 463)
modify the file agent.h in the common folder (Line 71)
modify the file agent.cc in the common folder (Line 70)
create a folder under ns-2.27 and put added files in it
modify the file tcl/lib/ns-default.tcl (Line 801)
modify the Makefile (Line 154)
recomplie NS2
RTP




add a folder into the ns directory
modify ns-default.tcl
modify the Makefile
recomplie NS2
Rests of this project

Correctly Decodable Frames in a GOP

A. Ziviani, B. E. Wolnger, J. F. Rezende, O. C. M. B. Duarte, and S.
Fdida, “Joint Adoption of QoS Schemes for MPEG Streams,”
Multimedia Tools and Applications, vol. 26 no. 1, pp. 59-80, May
2005.

計算機網路實驗—使用NS2模擬多媒體通訊與無線網路,
柯志亨團隊
Resources

Gunplot


Plot the analyzed results of awk
Web site

NS2 使用說明手冊


NS-2 Trace Formats


http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats
MPEG


http://hpds.ee.ncku.edu.tw/~smallko/ns2/ns2.htm
http://hpds.ee.ncku.edu.tw/~smallko/ns2/Evalvid_in_NS2.htm
RTP



http://140.116.72.80/~yufrank/YCY/myevalvid_rtp.htm
http://hpds.ee.ncku.edu.tw/~smallko/ns2/measure.htm
http://searun.iteye.com/blog/362415
Resources

Books


計算機網路實驗—以NS2模擬工具實作,柯志亨
計算機網路實驗—使用NS2模擬多媒體通訊與無線網路,
柯志亨團隊
Download