LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ns2 PUMA tace file shows no receiver with CBR packets at AGT on ubuntu 14.04 (https://www.linuxquestions.org/questions/linux-newbie-8/ns2-puma-tace-file-shows-no-receiver-with-cbr-packets-at-agt-on-ubuntu-14-04-a-4175576792/)

ankur_pareek 04-06-2016 12:55 AM

Ns2 PUMA tace file shows no receiver with CBR packets at AGT on ubuntu 14.04
 
I am working with ns2 and seeing the puma trace file which I get on executing the default puma.tcl. I see only source sending CBR at AGT but no receiver receiving CBr at AGt level.What could be the reason? Please help

TB0ne 04-06-2016 07:22 AM

Quote:

Originally Posted by ankur_pareek (Post 5526879)
I am working with ns2 and seeing the puma trace file which I get on executing the default puma.tcl. I see only source sending CBR at AGT but no receiver receiving CBr at AGt level.What could be the reason? Please help

The reason is: there is a problem in your TCL script.

Since you post absolutely NO details (version/distro of Linux, version of NS2, the TCL script, the input/output, etc.), how do you think ANYONE will be able to help you?

ankur_pareek 04-06-2016 09:59 AM

Sorry i am working on ubuntu 14.04 and I have used puma.tcl given in tcl/ex.

ankur_pareek 04-06-2016 10:12 AM

This is my awk script it also gives zero as expected as no CBR for receiver


BEGIN {
initialenergy = 100
maxenergy=0
n=100
nodeid=999
recvLine=0
sendLine=0
}
{

# Trace line format: energy
event = $1
time = $2
level= $4
traffic =$7

if (event =="r" || event =="d" || event =="s"|| event =="f") {
node_id = $9
energy=$17
}
if (event=="N"){
node_id = $5
energy=$7
}

####output
for (i=0; i<n; i++)
{


if (event == "r" && traffic =="cbr" ) {
if(level == "AGT")
recvLine ++ ;}

if ( event == "s" && traffic =="cbr") {
if(level == "AGT")
sendLine ++ ;
}


}

}

END {
printf("cbr s:%d r:%d, r/s Ratio:%.4f \n", sendLine, recvLine, (recvLine/sendLine));
}

ankur_pareek 04-06-2016 10:24 AM

#This is mu puma.tcl

set opt(stop) 15
set nodes 25
set mobility 1
set scenario 1
set pausetime 0
set traffic cbr
set senders 5
set receivers 20
set X 1000
set Y 1000

set ns_ [new Simulator]

set topo [new Topography]
$topo load_flatgrid $X $Y

set tracenam [open puma.nam w]
$ns_ namtrace-all-wireless $tracenam $X $Y

set tracefd [open puma.tr w]
#$ns_ use-newtrace
$ns_ trace-all $tracefd

set god_ [create-god $nodes]

$ns_ node-config -adhocRouting PUMA \
-llType LL \
-macType Mac/802_11 \
-ifqLen 50 \
-ifqType Queue/DropTail/PriQueue \
-antType Antenna/OmniAntenna \
-propType Propagation/TwoRayGround \
-phyType Phy/WirelessPhy \
-channel [new Channel/WirelessChannel] \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF

for {set i 0} {$i < $nodes} {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0;
}

puts "Loading connection pattern ..."
source "puma-cbr-ex"

puts "Loading scenarios file..."
source "puma-scenario-ex"

for {set i 0} {$i < $nodes} {incr i} {
$ns_ at $opt(stop) "$node_($i) reset";
}

Node instproc join { group } {
$self instvar ragent_
set group [expr $group]

$ragent_ join $group
}

Node instproc leave { group } {
$self instvar ragent_
set group [expr $group] ;

$ragent_ leave $group
}

$ns_ at $opt(stop) "$ns_ halt"
puts "Starting Simulation ..."
$ns_ run
puts "NS EXITING..."


All times are GMT -5. The time now is 01:17 AM.