- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- Problem with simulation of AODV and DSR
Dear Sir,
I’m doing a project on performance comparison of AODV, DSR and DSDV protocols. I need awk which I can use to evaluate throughput, jitter and average delays ,and confidence interval from the simulations result traces.
but, i have segmentation fault, when i use awk file with DSR
in file dsr .tr , i obtain
SSendFailure 599.762584453 _25_ 442249 2 8:1 9:1 25->3 1 5 3 6 [10 |25 3 2 18 9 ]
Ssalv 599.76258 _25_ salvaging 8 -> 9 — 442249 with [(25) 34 7 2 18 9 ]
SSendFailure 599.762584453 _25_ 442293 2 8:1 9:1 25->3 1 5 3 6 [10 |25 3 2 18 9 ]
Ssalv 599.76258 _25_ salvaging 8 -> 9 — 442293 with [(25) 34 7 2 18 9 ]
SFf 599.786537019 _10_ 442172 [7 -> 8] 959 to 12
DSR
# ======================================================================
# Define options
# ======================================================================
set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(ifq) CMUPriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(x) 1500 ;# X dimension of the topography
set val(y) 300 ;# Y dimension of the topography
set val(ifqlen) 50 ;# max packet in ifq
set val(seed) 1.0
set val(adhocRouting) DSR
set val(nn) 40 ;# how many nodes are simulated
set val(cp) “/home/armelle/ns-allinone-2.34/otcl-1.13/Simres/Mobilité_700/cbr_10”
set val(sc) “/home/armelle/ns-allinone-2.34/otcl-1.13/Simres/Mobilité_700/moda_70”
set val(stop) 705 ;# simulation time
# =====================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
# create simulator instance
set ns_ [new Simulator]
# setup topography object
set topo [new Topography]
# create trace object for ns and nam
set tracefd [open DSR_trouve.tr w]
set namtrace [open DSR_trouve.nam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
# define topology
$topo load_flatgrid $val(x) $val(y)
#
# Create God
#
set god_ [create-god $val(nn)]
# Create channel #1
set chan_1_ [new $val(chan)]
#
# define how node should be created
#
#global node setting
$ns_ node-config -adhocRouting $val(adhocRouting)
-llType $val(ll)
-macType $val(mac)
-ifqType $val(ifq)
-ifqLen $val(ifqlen)
-antType $val(ant)
-propType $val(prop)
-phyType $val(netif)
#-channelType $val(chan)
-channel $chan_1_
-topoInstance $topo
-agentTrace ON
-routerTrace OFF
-macTrace OFF
#
# Create the specified number of nodes [$val(nn)] and “attach” them
# to the channel.
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
# $node_($i) random-motion 0 ;# disable random motion
}
#
# Define node movement model
#
puts “Loading connection pattern…”
source $val(cp)
#
# Define traffic model
#
puts “Loading scenario file…”
source $val(sc)
# Define node initial position in nam
for {set i 0} {$i < $val(nn)} {incr i} {
# 20 defines the node size in nam, must adjust it according to your scenario
# The function must be called after mobility model is defined
$ns_ initial_node_pos $node_($i) 50
}
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).0 “$node_($i) reset”;
}
$ns_ at $val(stop).0002 “puts “end simulation…” ; $ns_ halt”
puts $tracefd “M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(adhocRouting)”
puts $tracefd “M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)”
puts $tracefd “M 0.0 prop $val(prop) ant $val(ant)”
puts “Starting Simulation…”
$ns_ run
AODV
# ======================================================================
# Define options
# ======================================================================
set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(ifq) Queue/DropTail/PriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(x) 1500 ;# X dimension of the topography
set val(y) 300 ;# Y dimension of the topography
set val(ifqlen) 50 ;# max packet in ifq
set val(seed) 1.0
set val(adhocRouting) AODV
set val(nn) 40 ;# how many nodes are simulated
set val(cp) “/home/armelle/ns-allinone-2.34/otcl-1.13/Simres/Mobilité_700/cbr_20”
set val(sc) “/home/armelle/ns-allinone-2.34/otcl-1.13/Simres/Mobilité_700/moda_700”
set val(stop) 705 ;# simulation time
# =====================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
# create simulator instance
set ns_ [new Simulator]
# setup topography object
set topo [new Topography]
# create trace object for ns and nam
set tracefd [open aodvprim.tr w]
set namtrace [open aodvprim.nam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
# define topology
$topo load_flatgrid $val(x) $val(y)
#
# Create God
#
set god_ [create-god $val(nn)]
# Create channel #1
set chan_1_ [new $val(chan)]
#
# define how node should be created
#
#global node setting
$ns_ node-config -adhocRouting $val(adhocRouting)
-llType $val(ll)
-macType $val(mac)
-ifqType $val(ifq)
-ifqLen $val(ifqlen)
-antType $val(ant)
-propType $val(prop)
-phyType $val(netif)
#-channelType $val(chan)
-channel $chan_1_
-topoInstance $topo
-agentTrace ON
-routerTrace OFF
-macTrace OFF
#
# Create the specified number of nodes [$val(nn)] and “attach” them
# to the channel.
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
# $node_($i) random-motion 0 ;# disable random motion
}
#
# Define node movement model
#
puts “Loading connection pattern…”
source $val(cp)
#
# Define traffic model
#
puts “Loading scenario file…”
source $val(sc)
# Define node initial position in nam
for {set i 0} {$i < $val(nn)} {incr i} {
# 20 defines the node size in nam, must adjust it according to your scenario
# The function must be called after mobility model is defined
$ns_ initial_node_pos $node_($i) 50
}
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).0 “$node_($i) reset”;
}
$ns_ at $val(stop).0002 “puts “end simulation…” ; $ns_ halt”
puts $tracefd “M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(adhocRouting)”
puts $tracefd “M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)”
puts $tracefd “M 0.0 prop $val(prop) ant $val(ant)”
puts “Starting Simulation…”
$ns_ run
my file awk
BEGIN {
nsent=0;
packet_id=0;
packet_duration=0;
duration=0;
nrecvd=0;
ndrop=0;
idfsent=0;
idfrec=0;
}
{
action = $1;
time = $2;
node_1 = $3;
type = $4;
n_seq = $6;
trafic=$7;
if (action == “D”)
{
ndrop++;
}
if (action == “s” && type == “AGT”)
{
start_time[n_seq]=time;
if (n_seq > idfsent)
{
idfsent=n_seq;
}
nsent++;
}
if (action == “r” && type == “AGT”)
{
end_time[n_seq]=time;
if (n_seq > idfrec)
{
idfrec=n_seq;
}
}
# if (trafic==”cbr”)
# {
# if (action == “s” || action == “r”)
# {
# if (n_seq > packet_id)
# {
# packet_id=$6;
# }
# }
# }
}
END {
for ( n_seq = 0; n_seq < idfrec ; n_seq++ ) {
start = start_time[n_seq];
end = end_time[n_seq];
if(start < end) {
nrecvd++;
packet_duration += (end – start);
duration += ((end – start)*(end – start));
}
}
if(nrecvd) {
delay = packet_duration/nrecvd;
# delay_carre = duration/nrecvd;
Packet_delivre= (nrecvd*100)/nsent;
carre=packet_duration*packet_duration/nrecvd;
calcul=sqrt(nrecvd);
test=((duration – carre)/(nrecvd – 1));
ecart=sqrt(test);
long_intervalle=2.0096*ecart/calcul;
printf(“%d %d %d %f %f %f n”,nsent,nrecvd,ndrop,delay,Packet_delivre,long_intervalle);
}
}
thanks you very much for your help
The scripts available from Internet (from previous projects) are used for doing trace analysis in a very generic manner for some specific/ideal scenario/case. If there will be an unusual event happening in the scenario then it will be reflected in the trace file. So the trace analysis script may fail with segmentation fault or divide by zero error or type error.
So just try to change the awk script little bit to handle such unusual situation.
The following link is discussing about another possibility.
http://mailman.isi.edu/pipermail/ns-users/2009-April/065265.html