'Network/Ns-2'에 해당되는 글 47건

  1. Network simulator3 ( ns3 ) 발표.. 2008/07/01
  2. NS2 Related Tools (1) 2007/11/10
  3. ns2 tcl소스 2007/07/26
  4. [AWK] throughput using AWK 관련 메일 (7) 2007/07/23
  5. awk와 xgraph를 이용한 출력 (8) 2007/07/23
  6. [ns] throughput in 802.11 (3) 2007/07/23
  7. ns2관련 awk있는 사이트 (6) 2007/07/19
  8. NS-2.28에 MANET DYMO 라우팅 프로토콜 설치 하기 (3) 2007/07/10
  9. NS-2 trace files analyser 설치및 활용하기 (2) 2007/07/10
  10. Ubuntu7.04에 ns2.31깔기.. (2) 2007/07/03
  11. The Design and Implementation of WiMAX Module for ns-2 Simulator (7) 2007/05/03
  12. ns2measure (2) 2007/04/28
  13. GUI기반의 ns2 (1) 2007/04/27
  14. Analyze Bandwidth Share of TCP and UDP Traffic (1) 2007/04/25
  15. NS-2.28 설치하기 (3) 2007/03/30
  16. [ns2] trasmission range_무선랜 전파 범위 설정 (9) 2007/03/14
  17. ns2 extension MIPv6 -Mobiwan (3) 2007/01/17
  18. GloMoSim 다운및 문서 (6) 2007/01/12
  19. Glomosim Without Parsec (10) 2007/01/12
  20. GloMoSim 2.03 Installation in Windows XP (3) 2007/01/12
  21. GLOMOSIM Installation Instructions (2) 2007/01/12
  22. GloMoSim Notes (3) 2007/01/12
  23. ns2 네트워크 성능 평가 가이드라인 잡기 -작성중- 2006/12/23
  24. 논문 시뮬레이션 tcl 파일 (2) 2006/12/21
  25. ns2 NAM파일 이용하여 총 TCP/FTP 트래픽 양 구하기 (9) 2006/12/19
  26. Ns2 awk script : throughput 계산 (7) 2006/12/19
  27. Monarch Project Research Papers (9) 2006/12/18
  28. Implementing a Routing Agent with convenient manually configured routing table (static routing) (2) 2006/12/18
  29. Ns2의 Trace format들..[작성중] (2) 2006/12/18
  30. Ns2 awk script : Routing Performance-전송률, 홉 카운트, 라우팅 오버헤드 (3) 2006/12/15

NS3


논문 때문에 종종 사용하는 Network simulator(ns)가 3로 버젼 업 하였네요..

전에 듣기로는 3개발은 좀 시간이 걸리고...GUI 기반일꺼라고 하던데...

이렇게 빨리 나올줄이야...대충 소개글을 읽어 보면 GUI는 아닌거 같고...

설치 해보고 추가 글 올릴께요...

다음은 관련 링크 입니다.


공식 홈페이지 : http://www.nsnam.org/
소개 블로그 : http://ns-2.blogspot.com/2008/07/ns-31-stable-release.html
다운 받기 : http://www.nsnam.org/releases/ns-3.1.tar.bz2
공식 메뉴얼 : http://www.nsnam.org/tutorials.html

특징
ns-3 is written in C++
Bindings in Python
Can run programs through a special waf shell; e.g. ?./waf --run simple-point-to-point

ns-3 is regularly tested on the following platforms:
- linux x86 gcc 4.2, 4.1, and, 3.4.6.
- linux x86_64 gcc 4.1.3, 4.2.1, 3.4.6
- MacOS X ppc and x86
- cygwin gcc 3.4.4 (debug only)

알려진 문제점 (ns-3 is known to fail on the following platforms)
- gcc 3.3 and earlier
- optimized builds on gcc 3.4.4 and 3.4.5
- optimized builds on linux x86 gcc 4.0.x


추가계획
Our next release, which is expected to happen in 2 to 4 months from now,
will feature the merging of some of our projects currently in
development: python scripting, IPv6, a statistics framework
and synchronous posix sockets.


간단 설치법

시스템 사양
유분투 8.04, Kernel 2.6.22, gcc 4.1.3

설치
wget http://www.nsnam.org/releases/ns-3.1.tar.bz2
tar xjvf ./ns-3.1.tar.bz2
cd ns-3.1
./waf   지져분하게 설치 되지만 빠르다고 하네요 -_-;
./waf --run simple-global-routing



=2008.07.02 추가=

NS3는 ns2의 확장이 아니라 전혀 새로운 시뮬레이션 툴이라고 합니다.
  • Simulation programs are C++ executables (python scripts)?
  • 그 예로 OTcl API를 포함 하고 있지 않다고 합니다.
  • 하지만 ns2와 어느 정도 호환이 가능하게 할려고 개발 중이라는군요
 GUI 기반으로 하지만. 현재 개발 중인거 같습니다.  아래가 그 예시 인듯합니다.
사용자 삽입 이미지
아래는 현재 ns2 와 ns3의기능을 구분한것입니다. 아직 개발 중이라.ns3가 많이 부족하네요.
사용자 삽입 이미지
하지만 2008.12월 까지 아래 내용을 완료할 계획이랍니다.
  • June 2008: ns-3 first stable release
    - simulator core, TCP/IPv4, point-to-point, CSMA,WiFi device models, mobility models
  • September 2008:
    - Python bindings, real-time scheduler, emulation, posix-like process API, initial IPv6 support, statistics framework
  • December 2008:
    - additional IPv6, quagga routing, Linux TCP port, others TBD
크게 정리 하면 2008년도 말에 구현된 내용은 아래와 같습니다.emulation modes, statistics, support for real code, additional ns-2 porting/integration, distributed simulation, visualization
waf를 사용 한다고 합니다.
waf는 Python기반의 프레임워크로 설정, 컴파일, 어플리케이션 설치가 가능하다고 하네요..(waf는 저도 처음 들어서리..)프로그램 실행도 ./waf --run simple-point-to-point 하면 tr파일이 생성되는듯 합니다.

또 다른 큰 특징은 실제 어플리케이션이나 리눅스 커널 네트워크 스택을 쉽게 통합할수 있게 한다고 합니다. 이렇게 할경우 추가 모듈 구현이 쉬워지고, 테스트 베드 구현시 추가 작업이 덜 들어 가게 하기 위해서 라고 하네요.
-결론 : (개인적 생각)
개발중이라 기능이 많이 부족하다.
ns2의 확장이 아니기에 새로 배워야 한다.
tr파일의 포맷이 바뀌면 여러 프로그램(ethereal)서 활용 가능하다
시뮬레이션 = 테스트 베드 구현...이 가능해진다.

p.s 처음 ns3 릴리즈 소식 듣고, 간략히 관련 문서 보고 정리 한것이라. 비 정확할수도 있습니다. 오역이 있을수도 ^^ 자세한 내용은 해당 링크를 참조 하세요.

p.s 좀 여유가 생기면 한번 돌려 보고 추가 하겠습니다.
작성 : 20080701 by 임헌정
추가 : 20080702 by 임헌정
http://www.4ellene.net
2008/07/01 23:52 2008/07/01 23:52

NS2 Related Tools

from Network/Ns-2 2007/11/10 14:05
NS2 Related Tools

From: http://alattw.blogspot.com/2007/07/ns2-releated-tools.html
other NS2 related articles: http://alattw.blogspot.com/search/label/ns-2

Thanks for listing Our Jtrana:)

[Analyzer, Trace]
NAM
Network Animator
http://www.isi.edu/nsnam/nam/index.html
Wikipage
http://www.nsnam.org/wiki/index.php/Main_Page



NANS - Network Analyzer for Network Simulator ns2
http://www.geocities.com/ankurjain009/projects.htm
NANS is the utility which brings all these features into one and from now
on wards, strives to eliminate all the problem associated with it.



TRACEGRAPH - Network Simulator NS-2 trace files analyzer
http://www.geocities.com/tracegraph/
Trace graph is a free network trace files analyzer developed for network simulator ns-2 trace processing.
Trace graph can support any trace format if converted to its own or ns-2 trace format.
Trace graph runs under Windows, Linux, UNIX and MAC OS systems.
Trace converter processes traces over 80x faster and is available to buy.



jTrana
https://sourceforge.net/projects/jtrana/
Jtrana is a Java-based NS-2 wireless simulation trace analyzer. Its input is an
NS2 wireless trace, and its output is a graph or data-set that can be plotted
with other tools such as Gnuplot.Any problem,
plz visit:http://ns2trana.googlepages.com
It's from Weiwei's Study (http://hi.baidu.com/vvfang).



[Scenarios Generator]
NSG2
http://wushoupong.googlepages.com/nsg
NS2 Scenarios Generator 2(NSG2) is a JAVA based ns2 scenarios generator.
Since NSG2 is written by JAVA language, you can run NSG on any platform. NSG2
is capable of generating both wired and wireless TCL scripts for ns2. This tool provides wireless node function. Below this does not have.



NS WorkBench - Graphical User Interface For Network Simulator
http://www.mnlab.cs.depaul.edu/projects/nsbench/
nsBench makes NS-2 simulation development and analysis faster and easier for
students and researchers without losing the flexibility or expressiveness gained
by writing a script.


The Network Simulator ns-2: Topology Generation
http://www.isi.edu/nsnam/ns/ns-topogen.html


The Network Simulator ns-2: Scenario Generation
http://www.isi.edu/nsnam/ns/ns-scengeneration.html


Mobility Generator program for NS-2
http://externe.emt.inrs.ca/users/nuevo/NSmobgenerator.htm

출처 : http://hi.baidu.com/vvfang/blog/item/de2349e7855f392db8382005.html

2007/11/10 14:05 2007/11/10 14:05
Tag //

ns2 tcl소스

from Network/Ns-2 2007/07/26 12:15
NS example

 NS examples for wireless scenario

[ A Simple One | A Complex One | Link Error Example  | Back to Network Simulator 2 for Wireless ]


This is a simple test scenario for 4x4 grid and 4 flows.

# ===================================================
# Author: ZHIBIN WU 06/19/2003
# ==================================================
# Zhibin Wu create this script to measure the pure
# throughput of 802.11 MAC, default data rate is 2Mbps
#

# handling command-line parameters first
if {$argc == 4} {
set cbr_size [lindex $argv 0]
set cbr_interval [lindex $argv 1]
set num_row [lindex $argv 2]
set time_duration [lindex $argv 3]
} else {
set cbr_size 500
set cbr_interval 0.002
set num_row 2
set time_duration 100
}
puts " the size of packet is $cbr_size and the interval of pkt is $cbr_interval
the size of grid is $num_row, duration is $time_duration seconds "


# ======================================================================
# Define options
# ======================================================================
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
#set val(mac) Mac/802_11 ;# MAC type
#set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(mac) Mac/PR_TDMA
set val(ifq) Queue/TDMAScheduler
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
#set val(nn) $num_node ;# number of mobilenodes

set val(rp) DSDV ;# routing protocol

# ======================================================================
# Main Program
# ======================================================================


#
# Initialize Global Variables
#
set ns_ [new Simulator]
set tracefd [open simple.tr w]
$ns_ trace-all $tracefd

# set up topography object
set topo [new Topography]

$topo load_flatgrid 5000 5000


set chan1 [new $val(chan)]

#
# Create God
#
create-god [expr $num_row * $num_row ]

#
# Create the specified number of mobilenodes [$val(nn)] and "attach" them
# to the channel.


# configure node

$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel $chan1 \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF\
-macTrace ON \
-movementTrace OFF


for {set i 0} {$i < [expr $num_row*$num_row ] } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}

#
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
#
#for {set k 0} {} {incr k}
set k 0;
while {$k < $num_row } {
for {set i 0} {$i < $num_row } {incr i} {
set m [expr $i+$k*$num_row];
$node_($m) set X_ [expr $i*240];
$node_($m) set Y_ [expr $k*240+20.0];
$node_($m) set Z_ 0.0

}
incr k;
};

set j [expr $num_row *($num_row -1)]
#j = 4*3 =12
#Create a UDP agent and attach it to node n0

for {set i 0} {$i < $num_row } {incr i} {

set n [expr $i+$j]
#set n 8
set udp_($i) [new Agent/UDP]
#$ns_ attach-agent $node_($i) $udp_($i)

set cbr_($i) [new Application/Traffic/CBR]
$cbr_($i) set packetSize_ $cbr_size
$cbr_($i) set interval_ 0.5
$cbr_($i) attach-agent $udp_($i)

set null_($i) [new Agent/Null]
#$ns_ attach-agent $node_($n) $null_($i)

#$ns_ connect $udp_($i) $null_($i)

}

$ns_ attach-agent $node_(0) $udp_(0)
$ns_ attach-agent $node_(7) $udp_(1)
$ns_ attach-agent $node_(2) $udp_(2)
#$ns_ attach-agent $node_(7) $udp_(3)

$ns_ attach-agent $node_(6) $null_(0)
$ns_ attach-agent $node_(1) $null_(1)
$ns_ attach-agent $node_(8) $null_(2)
#$ns_ attach-agent $node_(15) $null_(3)

for {set i 0} {$i < $num_row } {incr i} {
$ns_ connect $udp_($i) $null_($i)
}

# Create a CBR traffic source and attach it to udp0

$ns_ at 11.0234 "$cbr_(0) start"
$ns_ at 10.4578 "$cbr_(1) start"
$ns_ at 12.7184 "$cbr_(2) start"
#$ns_ at 12.2456 "$cbr_(3) start"
for {set i 0} {$i < 3 } {incr i} {
$ns_ at 50 "$cbr_($i) set interval_ $cbr_interval"
}

# Tell nodes when the simulation ends
#
for {set i 0} {$i < [expr $num_row*$num_row] } {incr i} {
$ns_ at [expr $time_duration +10.0] "$node_($i) reset";
}
$ns_ at [expr $time_duration +10.0] "finish"
$ns_ at [expr $time_duration +10.01] "puts \"NS Exiting...\"; $ns_ halt"

proc finish {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}

puts "Starting Simulation..."
$ns_ run

However, a more professional way to write the test tcl is to following the way in ns examples. For example, it is better to write traffic patten file and mobility file seperately and then source them in the main test tcl. Those files are generated respectively with cbrgen and setdest tools. Those files are ususally stored in "/ns-2.??/tcl/mobility/scene" directory.

This is an example for DSDV routing with 50 nodes in a 670*670 m2 area

# ======================================================================
# Default Script Options
# ======================================================================
set opt(chan) Channel/WirelessChannel
set opt(prop) Propagation/TwoRayGround
#set opt(netif) NetIf/SharedMedia
set opt(netif) Phy/WirelessPhy
#set opt(mac) Mac/802_11
set opt(mac) Mac/802_11
set opt(ifq) Queue/DropTail/PriQueue
set opt(ll) LL
set opt(ant) Antenna/OmniAntenna

set opt(x) 670 ;# X dimension of the topography
set opt(y) 670 ;# Y dimension of the topography
set opt(cp) "../mobility/scene/cbr-50-10-4-512"
set opt(sc) "../mobility/scene/scen-670x670-50-600-20-0"


set opt(ifqlen) 50 ;# max packet in ifq
set opt(nn) 50 ;# number of nodes
set opt(seed) 0.0
set opt(stop) 1000.0 ;# simulation time
set opt(tr) out.tr ;# trace file
set opt(rp) dsdv ;# routing protocol script
set opt(lm) "off" ;# log movement

# ======================================================================

#set AgentTrace ON
#set RouterTrace ON
#set MacTrace OFF
#useless code, the only way to toggle Mac trace on is to use node-config

LL set mindelay_ 50us
LL set delay_ 25us
LL set bandwidth_ 0 ;# not used
LL set off_prune_ 0 ;# not used
LL set off_CtrMcast_ 0 ;# not used

Agent/Null set sport_ 0
Agent/Null set dport_ 0

Agent/CBR set sport_ 0
Agent/CBR set dport_ 0

Agent/TCPSink set sport_ 0
Agent/TCPSink set dport_ 0

Agent/TCP set sport_ 0
Agent/TCP set dport_ 0
Agent/TCP set packetSize_ 1460

Queue/DropTail/PriQueue set Prefer_Routing_Protocols 1

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0

# ======================================================================

proc usage { argv0 } {
puts "Usage: $argv0"
puts "\tmandatory arguments:"
puts "\t\t\[-x MAXX\] \[-y MAXY\]"
puts "\toptional arguments:"
puts "\t\t\[-cp conn pattern\] \[-sc scenario\] \[-nn nodes\]"
puts "\t\t\[-seed seed\] \[-stop sec\] \[-tr tracefile\]\n"
}


proc getopt {argc argv} {
global opt
lappend optlist cp nn seed sc stop tr x y

for {set i 0} {$i < $argc} {incr i} {
set arg [lindex $argv $i]
if {[string range $arg 0 0] != "-"} continue

set name [string range $arg 1 end]
set opt($name) [lindex $argv [expr $i+1]]
}
}


proc cmu-trace { ttype atype node } {
global ns_ tracefd

if { $tracefd == "" } {
return ""
}
set T [new CMUTrace/$ttype $atype]
$T target [$ns_ set nullAgent_]
$T attach $tracefd
$T set src_ [$node id]

$T node $node

return $T
}




proc log-movement {} {
global logtimer ns_ ns

set ns $ns_
source ../mobility/timer.tcl
Class LogTimer -superclass Timer
LogTimer instproc timeout {} {
global opt node_;
for {set i 0} {$i < $opt(nn)} {incr i} {
$node_($i) log-movement
}
$self sched 0.1
}

set logtimer [new LogTimer]
$logtimer sched 0.1
}

# ======================================================================
# Main Program
# ======================================================================
getopt $argc $argv

#
# Source External TCL Scripts
#
#source ../lib/ns-mobilenode.tcl

#if { $opt(rp) != "" } {
#source ../mobility/$opt(rp).tcl
#} elseif { [catch { set env(NS_PROTO_SCRIPT) } ] == 1 } {
#puts "\nenvironment variable NS_PROTO_SCRIPT not set!\n"
#exit
#} else {
#puts "\n*** using script $env(NS_PROTO_SCRIPT)\n\n";
#source $env(NS_PROTO_SCRIPT)
#}
#source ../lib/ns-cmutrace.tcl
source ../lib/ns-bsnode.tcl
source ../mobility/com.tcl

# do the get opt again incase the routing protocol file added some more
# options to look for
getopt $argc $argv

if { $opt(x) == 0 || $opt(y) == 0 } {
usage $argv0
exit 1
}

if {$opt(seed) > 0} {
puts "Seeding Random number generator with $opt(seed)\n"
ns-random $opt(seed)
}

#
# Initialize Global Variables
#
set ns_ [new Simulator]
set chan [new $opt(chan)]
set prop [new $opt(prop)]
set topo [new Topography]
set tracefd [open $opt(tr) w]

$topo load_flatgrid $opt(x) $opt(y)

$prop topography $topo

#
# Create God
#
create-god $opt(nn)


#
# log the mobile nodes movements if desired
#
if { $opt(lm) == "on" } {
log-movement
}

$ns_ node-config -macTrace ON


#
# Create the specified number of nodes $opt(nn) and "attach" them
# the channel.
# Each routing protocol script is expected to have defined a proc
# create-mobile-node that builds a mobile node and inserts it into the
# array global $node_($i)
#

if { [string compare $opt(rp) "dsr"] == 0} {
for {set i 0} {$i < $opt(nn) } {incr i} {
dsr-create-mobile-node $i
}
} elseif { [string compare $opt(rp) "dsdv"] == 0} {
for {set i 0} {$i < $opt(nn) } {incr i} {
dsdv-create-mobile-node $i
}
}



#
# Source the Connection and Movement scripts
#
if { $opt(cp) == "" } {
puts "*** NOTE: no connection pattern specified."
set opt(cp) "none"
} else {
puts "Loading connection pattern..."
source $opt(cp)
}
# # Tell all the nodes when the simulation ends # for {set i 0} {$i < $opt(nn) } {incr i} { $ns_ at $opt(stop).000000001 "$node_($i) reset"; } $ns_ at $opt(stop).00000001 "puts \"NS EXITING...\" ; $ns_ halt" if { $opt(sc) == "" } {
puts "*** NOTE: no scenario file specified."
set opt(sc) "none"
} else {
puts "Loading scenario file..."
source $opt(sc)
puts "Load complete..."
}
puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)" puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)" puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)" puts "Starting Simulation..." $ns_ run

Note that all options listed in the beginning of the file could be initialized with command line arguments by using "getopt $argc $argv"


Example 3 : To attach the error model, add following codes:

     
..........
proc UniformErr {} {
set err [new ErrorModel]
$err unit packet
$err set rate_ 0.05
return $err
}
# $err rate_ 0.5 "invalid command ErrModel::Command does not support"
# the other valid method is " set err [new ErrorModel/Uniform 0.05 pkt] "
# the parameter rate ( 0 or 0.9) is a threshold that all packets all going through and 90% packets are
# going to be drop

proc TwoStateMarkovErr {} {

set tmp0 [new ErrorModel/Uniform 0 pkt]
set tmp1 [new ErrorModel/Uniform .7 pkt]

# Array of states (error models)
set m_states [list $tmp0 $tmp1]
# Durations for each of the states, tmp, tmp1 and tmp2, respectively
set m_periods [list 0.1 .075 ]
# Transition state model matrix
set m_transmx { {0.9 0.1 }
{0.7 0.3 } }
set m_trunit byte
# Use time-based transition
set m_sttype time
set m_nstates 2
set m_nstart [lindex $m_states 0]

set em [new ErrorModel/MultiState $m_states $m_periods $m_transmx \
$m_trunit $m_sttype $m_nstates $m_nstart]
return $em
}

$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel $chan1 \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF\
-macTrace ON \
-movementTrace OFF \
-IncomingErrProc TwoStateMarkovErr
#\
#-OutcomingErrProc TwoStateMarkovErr

#The other way to configure error
# $ns_ node-config --IncomingErrProc $opt(err)


출처 : http://www.winlab.rutgers.edu/%7Ezhibinwu/html/NS_examp.html#Example_3

2007/07/26 12:15 2007/07/26 12:15
Hi,

Below I have write my awk script to calculate throughput.

The columns that you need are:

column 7: TCP bytes sent
column 8: interval

then the throughput is

column7/column8

And, this script also calculates: bytes drops, packets drops, bytes
arrivals als packets arrivals.

I'm sorry, but the names of variables are in Spanish.

/salva

 


#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo "[$1:$2:$3] ...Obteniendo bytes/packets/flows sent/dropped TCP "
cat $TMP/out.tr | perl column 3 0 2 1 | sort -g |
awk '
   BEGIN { max = 0 }
   {
     # i          = fid
     # flujo[i,1] = packets_arrivals (+)
     # flujo[i,2] = packets_drops    (d)
     # flujo[i,3] = packets_sent     (-)
     # flujo[i,4] = bytes_arrivals
     # flujo[i,5] = bytes_drops
     # flujo[i,6] = bytes_sent
     # flujo[i,7] = instante inicio
     # flujo[i,8] = instante final

     i      = $1;
     tiempo = $4;
     evento = $2;

     max = ((i > max) ? i : max);

     contabilizar = 0;

     if (evento == "+") {
        flujo[i,1]++;
        flujo[i,4] += $3;
        contabilizar = 1;
     } else if (evento == "d") {
        flujo[i,2]++;
        flujo[i,5] += $3;
        contabilizar = 1;
     } else if (evento == "-") {
        flujo[i,3]++;
        flujo[i,6] += $3;
        contabilizar = 1;
     }

     if (contabilizar == 1) {
        tiempo = $4;

        if (flujo[i,7] == 0) { flujo[i,7]= tiempo };
        if (flujo[i,8] == 0) { flujo[i,8]= tiempo };

        if ( tiempo < flujo[i,7]) { flujo[i,7] = tiempo};
        if ( tiempo > flujo[i,8]) { flujo[i,8] = tiempo};
     }
   }
   END {
      for (i=0; i<=max ; i++) {
        lapsus = flujo[i,8] - flujo[i,7];

        if ( lapsus > 0 ) { printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%f\n",i,flujo[i,1],flujo[i,2],flujo[i,3],flujo[i,4],flujo[i,5],flujo[i,6],lapsus) }
      }
   }' > $TMP/tcp_flows.dat


#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#::: FIN
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

 

 

 

 

On Mon, 26 Mar 2007, paul yoong wrote:

>
> Hi all,
>
> I want to calculate the throughput of a link using awk. Can anyone tell me how to do this for a simple 2 node link. If anyone could direct me to any example on the web that would be great.
>
> Thanks


출처 : http://aza97.egloos.com/
2007/07/23 20:10 2007/07/23 20:10
#awk '{print $1,$4}' input_file.tr | xgraph

이렇게 하면 input_file.tr 의 첫번째와 네번째 인자를 가지고 xgraph로 그려준다. 이때, xgraph의 옵션도 줄수 있다.

xgraph의 옵션을 살펴보자.

Usage: xgraph [-device <ps|X|hpgl|idraw|tgif>]
        [-bd border_color] [-bg background_color] [-fg foreground_color]
        [-bar] [-brb bar_base] [-brw bar_width] [-bof bar_offset] [-stk]
        [-bw bdr_width] [-db]  [-gw grid_size] [-fitx] [-fity]
        [-gs grid_style] [-lf label_font] [-lnx] [-lny] [-lw line_width]
        [-lx x1,x2] [-ly y1,y2] [-m] [-M] [-nl] [-ng] [-nb] [-p] [-P]
        [-rv] [-t title] [-tf title_font] [-tk] [-scale factor]
        [-x x_unit_name] [-y y_unit_name] [-fmtx format] [-fmty format]
        [[-geometry |=]W=H+X+Y] [[-display] <host>:<disp>.<screen>]
        [-Pprinter|-o output_file|-O output_file] [[-<digit> set_name]
        [-zg zero_color] [-zw zero_size] [-a] [-dl <delay>] input_files...
 
-bar   Draw bar graph with base -brb, width -brw, and offset -bof
-stk   Draw bar graph stacking data sets.
-fitx  Scale all sets to fit the x-axis [0,1].
-fity  Scale all sets to fit the y-axis [0,1].
-fmtx  Printf format for the x-axis
-fmty  Printf format for the y-axis
-scale Scale the output file with factor
-O fn  Printer ready output file
-o fn  Encapsulated (document) output file
-bb    Draw bounding box around data
-db    Turn on debugging
-lnx   Logarithmic scale for X axis
-lny   Logarithmic scale for Y axis
-m -M  Mark points distinctively (M varies with color)
-nl    Don't draw lines (scatter plot)
-ng    Don't draw legend
-nb    Don't draw buttons
-p -P  Mark points with dot (P means big dot)
-rv    Reverse video on black and white displays
-tk    Draw tick marks instead of full grid
-a     Start in animation mode
-dl    Animation delay.  Default is 2

xgraph에서 와일드카드인 ?를 이용하면 여러 파일에 대한 내용을 그래프 하나에 표시할 수 있다. 예를 들어,

test1.tr, test2.tr, test3.tr 파일이 있다면

#xgraph test?.tr

이렇게 해주면 세 파일의 내용을 하나에 그려준다.

출처 : http://www.joon.pe.kr/blog/32

[추가-080613] -bar옵션 사용법
xgraph -bar -brw 0.6 -nl -ng -x "Adv Interval" -y "Time(s)" datafile1 datafile2

-brw 0.6  : border width 를 0.6으로
-nl : line을 보여주지 않음
-ng : legend 를 보여주지 않음
-x "Adv Interval" : x축의 unit name
-y "Time(s)"  : y축의 unit name

출처 : 네이버 지식인


[추가-080613]  에러발생
Error in file `out.xg' at line 115:
  Unknown line type
Error in file `out.xg' at line 116:
  Unknown line type
Problems found with input data.

out.xg파일 내용
-t 913
-t 913
-t 912
-t 912

가정 :  xgraph는 단지 x와 y의 값을 출력해주는데 '-t'라는 잘못된 값이 들어 가서 에러가 발생하는거 같다.
원인 : raw2xg가 특정 tr버젼에서만 작동해서 발생 하는거 같다
해결 : tcl파일에서 tr저장 형식 변경

출처 : 내머리^^;


2007/07/23 20:08 2007/07/23 20:08
Tag //

[ns] throughput in 802.11

from Network/Ns-2 2007/07/23 20:06
[ns] throughput in 802.11



--=-4u/lpYXeoH45EUz4ZptR
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Here are two awk scripts that will calculate throughput from the output
of a CMU trace file for wireless networks. The first will display for
each node: node id, total number of bytes received, total time, and
average throughput.

The second script is more involved and will output average delay,
dropped packets, collisions, etc over all nodes on the WLAN. In addition
it will create the files throughput.dat, delay.dat, and rate.day for the
delay/throughput/rate measured at each node. The script was written for
a simulation with a fixed packet size (1000 bytes), so the script counts
packets not bytes. It may not be useful because it is very specific for
the simulation I was running, but it gives an example of how to generate
more statistics out of the trace file.

Unfortunately, I do not remember from whom I obtained the original awk
script for throughput (from someone on this list?). My apologies to the
author.

To run the script on trace file, out.tr:
throughput < out.tr

m

On Mon, 2002-09-09 at 12:55, Bhaskar Anepu wrote:
>
> Hi,
> I'm facing a problem plotting thruput curves using
> tracegraph as my trace files are very big (around 120
> Mb each). i would appreciate if you mail some perl
> scripts so that i can go through them and start
> writing my own stuff.
>
> Regards,
> Bhaskar.

--
Michael Mercurio
lafcadio@bu.edu

--=-4u/lpYXeoH45EUz4ZptR
Content-Disposition: attachment; filename=throughput
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=throughput; charset=ISO-8859-1

#!/usr/bin/awk -f
#
# AWK script to compute throughput of nodes
# in ns trace output file.
#
# - Only nodes that have received data will
# be counted (throughput of 0 not reported).
# - Only Agent (AGT) data is counted.
#=20
# Throughput is:=20
# total bytes received / tdelta
#
# where tdelta is the time difference
# of when the first packet is sent=20
# and the last packet is received.
#
# Last updated: March 30, 2002 0912 mm=20
/ AGT / {
# these are for the new trace
# new_time =3D $3;
# new_node =3D $9=20
# new_bytes =3D $37

event =3D $1
time =3D $2;
node =3D $3;
bytes =3D $8;

# strip leading and trailing _ from node
sub(/^_*/, "", node);=20
sub(/_*$/, "", node);

if ( event =3D=3D "s" ) {
if ( time < start_time[node] || start_time[node] =3D=3D 0 )
start_time[node] =3D time;
}
else if ( event =3D=3D "r" ) {
if ( time > end_time[node] )=20
end_time[node] =3D time;
total_bytes[node] +=3D bytes;
}
}
END {
for ( node in total_bytes ) {
if ( total_bytes[node] > 0 ) {
tdelta =3D end_time[node] - start_time[node];
printf("%d %d %f %d\n",=20
node,=20
total_bytes[node],=20
tdelta,
total_bytes[node]*8 / tdelta);
}
}
}

--=-4u/lpYXeoH45EUz4ZptR
Content-Disposition: attachment; filename=genstats
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=genstats; charset=ISO-8859-1

#! /usr/bin/awk -f
#
# Parse a ns2 wireless trace file and generate the following stats:
# - number of flows (senders)
# - time of simulation run
# - number of packets sent (at the Application)
# - number of packets received (at the Application)
# - number of packets dropped (at the Application)
# - number of collisions (802.11)
# - average delay
# - average throughput
# - average traffic rate (measured)
#
# Last updated: April 5, 2002 0113 mm
function average (array) {
sum =3D 0;
items =3D 0;
for (i in array) {
sum +=3D array[i];
items++;
}
# printf("DEBUG sum is %d, items is %d\n", sum, items);
if (sum =3D=3D 0 || items =3D=3D 0)
return 0; =20
else
return sum / items;
}

function max( array ) {
for (i in array) {
if (array[i] > largest)
largest =3D array[i];
}
return largest;
}

function min(array) {
for (i in array) {
if (0 =3D=3D smallest)
smallest =3D array[i];
else if (array[i] < smallest)
smallest =3D array[i];
}
return smallest;
}
BEGIN {
total_packets_sent =3D 0;
total_packets_received =3D 0;
total_packets_dropped =3D 0;
first_packet_sent =3D 0;
last_packet_sent =3D 0;
last_packet_received =3D 0;
}
{
event =3D $1;
time =3D $2;
node =3D $3;
type =3D $4;
reason =3D $5;
packetid =3D $6;

# strip leading and trailing _ from node
sub(/^_*/, "", node);=20
sub(/_*$/, "", node);

if ( time < simulation_start || simulation_start =3D=3D 0 )
simulation_start =3D time;
if ( time > simulation_end )
simulation_end =3D time;

if ( reason =3D=3D "COL" )
total_collisions++;

if ( type =3D=3D "AGT" ) {
nodes[node] =3D node; # to count number of nodes
if ( time < node_start_time[node] || node_start_time[node] =3D=3D 0=
)
node_start_time[node] =3D time;

if ( time > node_end_time[node] )
node_end_time[node] =3D time;

if ( event =3D=3D "s" ) {
flows[node] =3D node; # to count number of flows
if ( time < first_packet_sent || first_packet_sent =3D=3D 0 )
first_packet_sent =3D time;
if ( time > last_packet_sent )
last_packet_sent =3D time;
# rate
packets_sent[node]++;
total_packets_sent++;

# delay
pkt_start_time[packetid] =3D time;
}
else if ( event =3D=3D "r" ) {
if ( time > last_packet_received )
last_packet_received =3D time;
# throughput
packets_received[node]++;
total_packets_received++;
=20
# delay
pkt_end_time[packetid] =3D time;
}
else if ( event =3D=3D "D" ) {
total_packets_dropped++;
# pkt_end_time[packetid] =3D time; # EXPERIMENTAL=20
}
}
}
END {
print "" > "throughput.dat";
print "" > "rate.dat";
number_flows =3D 0;
for (i in flows)
number_flows++;

# find dropped packets
if ( total_packets_sent !=3D total_packets_received ) {
printf("***OUCH*** Dropped Packets!\n\n");
for ( packetid in pkt_start_time ) {
if ( 0 =3D=3D pkt_end_time[packetid] ) {
total_packets_dropped++;
# pkt_end_time[packetid] =3D simulation_end; # EXPERIMENTAL
}
}
}

for (i in nodes) {
if ( packets_received[i] > 0 ) {
end =3D node_end_time[i];
start =3D node_start_time[i - number_flows];
runtime =3D end - start;
if ( runtime > 0 ) {
throughput[i] =3D packets_received[i]*8000 / runtime;
printf("%d %f %f %d\n", i, start, end, throughput[i]) >> "t=
hroughput.dat";
}
}
# rate - not very accurate
if ( packets_sent[i] > 2 ) {
end =3D node_end_time[i];
start =3D node_start_time[i];
runtime =3D end - start;
if ( runtime > 0 ) {
rate[i] =3D (packets_sent[i]*8000) / runtime;
printf("%d %f %f %d\n", i, start, end, rate[i]) >> "rate.da=
t";
}
}
}

# delay
for ( pkt in pkt_end_time) {
end =3D pkt_end_time[pkt];
start =3D pkt_start_time[pkt];
delta =3D end - start;
if ( delta > 0 ) {
delay[pkt] =3D delta;
printf("%d %f %f %f\n", pkt, start, end, delta) > "delay.dat";
}
}
=20
# offered load
total_runtime =3D last_packet_sent - first_packet_sent;
if ( total_runtime > 0 && total_packets_sent > 0)
load =3D ((total_packets_sent * 8000)/total_runtime) / 2000000; # n=
o overhead

printf("\
RUN OFFERED PACKETS PACKETS PACKETS AVERAGE MAX =
MIN AVERAGE AVERAGE\n\
FLOWS TIME LOAD SENT RECEIVED DROPPED COLLISIONS DELAY DELAY =
DELAY THROUGHPUT TRAFFIC RATE\n\
----- ----- ------- -------- -------- -------- ---------- ---------- ------=
---- ---------- ------------ ------------\n");

printf("%5d %5.1f %7.4f %8d %8d %8d %10d %10.4f %10.4f %10.4f %12d %12d=
\n",
number_flows,
total_runtime,
load,
total_packets_sent,
total_packets_received,
total_packets_dropped,
total_collisions,
average(delay),
max(delay),
min(delay),
average(throughput),
average(rate));

printf("%5d %5.1f %7.4f %8d %8d %8d %10d %10.4f %10.4f %10.4f %12d %12d=
\n",
number_flows,
total_runtime,
load,
total_packets_sent,
total_packets_received,
total_packets_dropped,
total_collisions,
average(delay),
max(delay),
min(delay),
average(throughput),
average(rate)) >> "stats.dat";
}

--=-4u/lpYXeoH45EUz4ZptR--

출처 : http://mailman.isi.edu/pipermail/ns-users/2002-September/025628.html
http://www.gongdory.co.kr/390


2007/07/23 20:06 2007/07/23 20:06
Tag //
EEC 687/787 - Mobile Computing (Spring 2007)

Instructor

Prof. Yu Chansu, e-mail: c.yu91@csuohio.edu, Office: SH 437, phone: 2584, Office hour: TR 4-6pm

Course Information

Download here (including syllabus, grading policy, homework assignments, course schedule, etc.)

Notices
Downloadable Materials
  • Week 11
    • Extra lab for Mobile IP
      • Note that trace format for wired node is different from wireless (see Trace file format in ns-2)
      • Note also that the 9th item in a wired trace has 4-component source address, where the first three components are the hierarchical address of the wired node and the last component is the port number
  • Week 10
    • March 26 class starts at 1pm
  • Week 08
    • Mobile IP
    • Access C++ from TCL with ns-2
      • Some additions (distance and CPThresh values, new scenario)
      • Some corrections (Lab exercise, 6, 18, 36 and 54 Mbps)
      • Some revisions (Homework #3)
      • Parameters (Common)
        Phy/WirelessPhy set Pt_ 3.981e-3
        Phy/WirelessPhy set CSThresh_ 7.943e-13
      • Parameters (6Mbps)
           Mac/802_11 set dataRate_        6.0e6
           Phy/WirelessPhy set bandwidth_ 6e6
           Mac/802_11 set PLCPDataRate_ 6.0e6      
           Phy/WirelessPhy set CPThresh_ 3.999
           Phy/WirelessPhy set RXThresh_ 6.310e-12
      • Parameters (18 Mbps)
           Mac/802_11 set dataRate_        18.0e6
           Phy/WirelessPhy set bandwidth_ 18e6
           Mac/802_11 set PLCPDataRate_ 18.0e6      
           Phy/WirelessPhy set CPThresh_ 11.995
           Phy/WirelessPhy set RXThresh_ 1.995e-11
      • Parameters (36 Mbps)
           Mac/802_11 set dataRate_        36.0e6
           Phy/WirelessPhy set bandwidth_ 36e6
           Mac/802_11 set PLCPDataRate_ 36.0e6      
           Phy/WirelessPhy set CPThresh_ 75.858
           Phy/WirelessPhy set RXThresh_ 1.000e-10
      • Parameters (54 Mbps)
           Mac/802_11 set dataRate_        54.0e6
           Phy/WirelessPhy set bandwidth_ 54e6
           Mac/802_11 set PLCPDataRate_ 54.0e6      
           Phy/WirelessPhy set CPThresh_ 285.759
           Phy/WirelessPhy set RXThresh_ 3.162e-10
    • Reading
      • J. Schiller, "Mobile network layer," Chapter 8.1~8.2
      • A. Myles, D. Johnson, C. Perkins. A Mobile Host Protocol Supporting Route Optimization and  
          Authentication. IEEE Journal on Selected Areas in Communications, special issue on ``Mobile and