You are on page 1of 18

Periodical report no.

1
Lecturer: Nguyễn Trung Dũng
Student: Nguyễn Mạnh Tú (NT)
Ngô Đắc Vinh Quang
Trần Thành
Nội Dung
• 1 introduction
1.1 Ns2 overview
1.2 Nam
1.3 Xgraph
1.4 Format of trace file
• 2 Simulation
1.1 NS2 overview (1)
• NS is an object oriented simulator targeted at
networking research, written in C++.
• NS provide support for networking research
and education:
– Protocol design, traffic studies, etc
– Protocol comparison
– New architecture design are also support
1.1 NS2 overview (2)
• Ns 2 use two languages: C++ and Otcl.
– C++ faster to run but slower to change, => suitable
for detailed protocol implementation.
– Otcl slower to run but faster to change => suitable
for simulation configuration.
1.1 NS2 overview (3)
• protocol/models supported
– Wired network
• Routing: unicast, multicast, hierarchical routing, etc.
• Transportation: TCP, UDP, others;
• Traffic sources: web, ftp, telnet, cbr, etc.
• Queuing disciplines: drop-tail, RED, etc.
• Qos: intServ and Diffserv wireless networking
– Adhoc routing and mobile IP
– Sensor network
– Satellite network
1.2 Nam – Network animator
• Nam provides a visual interpretation of the
network topology created. It can be executed
directly from a TCL script.
• Nam support:
– Provide darg and drop interface for creating
topologies.
– Control button include pause, play, stop, speed
controler.
1.3 xgraph - Graph plotting tool
• Xgraph analyse trace files produces from ns2
to draw graph.
• We use awk script to extract the necessary
information from frace file (.tr)
• Xgraph can be called in tcl script
1.4 Format of trace file (1)
• Format of trace file generated by NS
<event> <time> <from> <to> <pkt-type> <pkt-
size> <flags> <fid> <src> <dst> <seq> <uid>
• Trace example
+ 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0
- 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0
r 1.00234 0 2 cbr 210 ------- 0 0.0 3.1 0 0
1.4 Format of trace file (new format)
(2)
Example: s -t 0.267662078 -Hs 0 -Hd -1 -Ni 0 -Nx
5.00 -Ny 2.00 -Nz 0.00 -Ne -1.000000 -Nl RTR -Nw
--- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 0.255 -Id -1.255 –
It
• Event type: describe the type of event
s – send; r – receive; d – drop; f – forward.
• General tag: stand for time.
• Node property tags: start with a leading “-N”
-Ni: Node id; -Ne: Node energy level; - Nx: node’s
x-coordinate; -Ny: node’s y-coordinate; -Nl trace
level, such as AGT,RTR,MAC
1.4 Format of trace file (new format)
(3)
• Next hop info: starts with a leading “-H”
-Hs: id of hop source; -Hd: id of hop destination
• Packet info at Mac level: start with “-M”
• Packet info at IP level: start with “-I”
• Packet info at application level: start with “-P”
2 simulation
• topology

TCP

UDP
screenshot
Code tcl
Drop-CBR.awk script
• BEGIN {numd=0;numr=0}
• {
• if (($1=="d")&&($4==3)&&($8==1))
• { numd++; }
• if (($1=="+")&&($3==1))
• { numr++;
• print $2 " " numd/numr;}
• }END{}
Drop-ftp.awk script
• BEGIN {numd=0;numr=0}
• {
• if (($1=="d")&&($4==3)&&($8==2))
• { numd++; }
• if (($1=="+")&&($3==0))
• { numr++;
• print $2 " " numd/numr;}
• }END{}
Packet loss ratio graph
Next target
• Principle of adhoc network
• Simulation a simple adhoc network
Thank you for listening

You might also like