LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Zrp integration (https://www.linuxquestions.org/questions/linux-newbie-8/zrp-integration-4175526171/)

Apsingh111 11-22-2014 04:01 AM

Zrp integration
 
Hiii.. i am going to integrate the zrp in ns2.35 and facing the error.... plz help me to remove this error....


trace/cmu-trace.o: In function `hdr_zrp::access(Packet const*)':
cmu-trace.cc:(.text._ZN7hdr_zrp6accessEPK6Packet[hdr_zrp::access(Packet const*)]+0x7): undefined reference to `hdr_zrp::offset_'
collect2: ld returned 1 exit status
make: *** [ns] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

knudfl 11-23-2014 08:55 AM

Welcome to LQ.

How to avoid errors : Use the right commands.
* But : We don't know which commands you have used.

HOWTO zrp, ns-2.35 :
$ tar xvf ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
$ patch -p0 < zrp-ns235.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing
$ ./install
$ cd ns-2.35/
$ cp ns ns235-zrp
# cp ns235-zrp /usr/local/bin/
..... Then you can do $ ns235-zrp example-zrp.tcl
.. and $ ns235-zrp zrp-Demo2-1.tcl
.. from the examples, zrp-examples-2012.tar.bz2
https://drive.google.com/file/d/0B7S...ew?usp=sharing

-

Mellia 03-27-2015 03:08 AM

hai knudfl i've been following your step to patch zrp in ns2.35 ubuntu 14.04 32 bit
every step that i've followed sucessfully
but when i run the tcl from the links that you gave all of them were failed

agustus@agustus-Presario-CQ42-Notebook-PC:~/agustus/ns-allinone-2.35/ns-2.35$ ns235-zrp test_zrp.txt
invalid command name "Agent/ZRP"
while executing
"Agent/ZRP set radius_ 2"
(file "test_zrp.txt" line 15)

can you help me to solve the error?
because i've been looking for the solution but when i run it again the error keeps showing.

thank you for your attention

knudfl 03-27-2015 09:28 AM

Post #3, @Mellia : Welcome to LQ.

I guess you mean test_zrp.tcl, and not test_zrp.txt.
? How about $ ns235-zrp zrp-Demo2-1.tcl

About your error ( invalid command name "Agent/ZRP" ) :
Looks like you have a failed build.

There is a line missing in post #2 : $ cd ns-allinone-2.35/ >>>

>> Ubuntu >>>
$ tar xvf ns-allinone-2.35_gcc482.tar.gz
$ cd ns-allinone-2.35/
$ patch -p0 < zrp-ns235.patch
$ ./install
$ cd ns-2.35/
$ cp ns ns235-zrp2
$ sudo cp ns235-zrp2 /usr/local/bin/

$ ns235-zrp example-zrp.tcl
$ ns235-zrp zrp-Demo2-1.tcl


-

Mellia 03-30-2015 01:21 AM

thanks knudfl it works :)

shivee 09-28-2015 04:23 AM

zrp
 
$ns235-zrp example-zrp.tcl
ns235-zrp: command not found

Please tell me how to resolve this error and run ZRP.

knudfl 09-28-2015 05:29 AM

Re #6, @shivee
Quote:

ns235-zrp: command not found
The file "ns235-zrp" is one that you create when building ns-2.35 + ZRP.

ZRP info :
. http://www.linuxquestions.org/questions/tags/zrp/
. https://groups.google.com/forum/?fro.../zrp|sort:date

* ns235 build example :
tar xvf ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
cd ns-allinone-2.35/
patch -p0 < zrp-ns235.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing
./install
cd ns-2.35/
cp ns ns235-zrp
sudo cp ns235-zrp /usr/local/bin/
.... Simulation example : ns235-zrp zrp-Demo1-1.tcl


-

shivee 09-28-2015 05:52 AM

thank you :) how to execute a nam file to visualise the simulation in ns2.35?

knudfl 09-28-2015 07:59 AM

Re #8.

NAM :
$ cd ns-allinone-2.35/nam-1.15/
$ sudo make install
('make install' will copy the executable 'nam' to /usr/local/bin/).


Using : 'ns235-zrp zrp-Demo1-1.tcl' will create the file `scatternet10.nam'.
( And scatternet10.tr ).
NAM : $ nam scatternet10.nam &
... the nam window will open. Hit the "play button" to watch the animation.

And $ ns235-zrp example-zrp.tcl : Will create `pktdemo.nam'.


-

shivee 09-29-2015 03:49 AM

awk scripts
 
Thank You :) I need awk scripts for finding routing traffic received,throughput,reachability ratio,route discovery delay,broadcast retransmission,energy consumption for ZRP. Also while trying your steps, the installation of nam has failed stating 'no such file found error'.What to do now?

shivee 09-29-2015 04:53 AM

awk and trave
 
do awk scripts to calculate throughput and other such parameters vary for different trace files?

knudfl 09-29-2015 04:57 AM

Re #10.

""I need awk scripts"" :
Well, then have a look into awk#perl#python__scripts-09.2015.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing

If no luck finding a usable script, you can edit a script to your requirements.
Or you can write your own awk or perl code.

----

NAM : If the './install' failed with nam-1.15 : Use ns-allinone-2.35_gcc482.tar.gz .
Or use a tested package :
http://www.linuxquestions.org/questi...-4175524760/#2
.. Download the package, click the downloaded package, and it will be installed.
Or do : $ sudo dpkg -i nam***.deb

Note : The Ubuntu nam packages cannot be used. Ref. the one year old bug report.


-

knudfl 09-29-2015 05:07 AM

Re #11.

Depends what you are doing. And why not test that yourself ?

shivee 09-29-2015 05:12 AM

the initialised values in awk scripts are getting printed as such.how to get the actual data from the trace files?

shivee 09-29-2015 05:22 AM

Code:


# ======================================================================
# Define options
# ======================================================================
Mac/802_11 set dataRate_ 11Mb              ;#Rate for Data Frames
 set val(chan)        Channel/WirelessChannel  ;# channel type
 set val(prop)        Propagation/TwoRayGround ;# radio-propagation model
 set val(ant)          Antenna/OmniAntenna      ;# Antenna type
 set val(ll)          LL                      ;# Link layer type
 set val(ifq)          Queue/DropTail/PriQueue  ;# Interface queue type
 set val(ifqlen)      50                      ;# max packet in ifq
 set val(netif)        Phy/WirelessPhy          ;# network interface type
 set val(mac)          Mac/802_11              ;# MAC type
 set val(nn)          100                      ;# number of mobilenodes
 set val(rp)              ZRP                    ;# routing protocol
 set val(x)            10000
 set val(y)            10000
 set val(stop)              10 ;
Agent/ZRP set radius_ 9 ;
set ns [new Simulator]
#ns-random 0

set tracefd [open zrp_9.tr w]
#set windowVsTime2 [open win.tr w]
set namtrace [open zrp_9.nam w]
$ns use-newtrace
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

#set f0 [open So_Goi_Da_Gui.tr w]
#set f1 [open So_Goi_Mat.tr w]
#set f2 [open proj_out2.tr w]
#set f3 [open proj_out3.tr w]


set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)


set chan_1 [new $val(chan)]

# CONFIGURE AND CREATE NODES

$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) \
                #-channelType $val(chan) \
                -topoInstance $topo \
                -agentTrace OFF \
                -routerTrace ON \
                -macTrace ON \
                -movementTrace OFF \
                -channel $chan_1  # \


proc finish {} {
        global ns f f0 f1 f2 f3 namtrace
        $ns flush-trace
        close $namtrace 

        exec nam -r 5m zrp_9 &
        exit 0
}

proc record {} {
  global sink0 sink1 sink2 sink3 sink4 sink5 sink6 sink7 sink8 sink9 f0 f1 f2 f3
  #Get An Instance Of The Simulator
  set ns [Simulator instance]
 
  #Set The Time After Which The Procedure Should Be Called Again
  set time 0.05
  #How Many Bytes Have Been Received By The Traffic Sinks?
  set bw0 [$sink9 set npkts_]
  set bw1 [$sink9 set nlost_]

  #set bw2 [$sink2 set npkts_]
  #set bw3 [$sink3 set npkts_]
 
  #Get The Current Time
  set now [$ns now]
 
  #Save Data To The Files
  puts $f0 "$now [expr $bw0]"
  puts $f1 "$now [expr $bw1]"
  #puts $f2 "$now [expr $bw2]"
  #puts $f3 "$now [expr $bw3]"

  #Re-Schedule The Procedure
  $ns at [expr $now+$time] "record"
  }
 
for {set i 0} {$i < $val(nn)} {incr i} {
set n_($i) [$ns node]
#$n_($i) random-motion 0
$ns initial_node_pos $n_($i) 20
}


for {set i 0} {[expr $i < $val(nn)/10]} {incr i} {
for {set j 0} {$j < 10} {incr j} {
set id [expr $i*10 + $j]
$n_($id) set X_ [expr $j*100+120]
$n_($id) set Y_ [expr $i*100+120]
$n_($id) set Z_ 0.0
}
}

for {set i 0} {$i < $val(nn)} {incr i} {
if {$i3 == 0} {
$ns at 0.0 "$n_($i) setdest [expr $i7*1040+20] [expr $i3*3000+20] 5.0"
}

if {$i3 == 1} {
$ns at 0.0 "$n_($i) setdest [expr $i%6+20] [expr $i%3*3000+20] 5.0"
}

if {$i%3 == 2} {
$ns at 0.0 "$n_($i) setdest [expr $i%7*1040+20] [expr $i%3+10] 5.0"
}
}

# CONFIGURE AND SET UP A FLOW

for {set i 0} {$i < $val(nn)} {incr i} {
set sink_($i) [new Agent/LossMonitor]
$ns attach-agent $n_($i) $sink_($i)

set tcp_($i) [new Agent/TCP]
$ns attach-agent $n_(0) $tcp_($i)
}




proc attach-CBR-traffic { node sink size interval } {
  #Get an instance of the simulator
  set ns [Simulator instance]
  #Create a CBR  agent and attach it to the node
  set cbr [new Agent/CBR]
  $ns attach-agent $node $cbr
  $cbr set packetSize_ $size
  $cbr set interval_ $interval

  #Attach CBR source to sink;
  $ns connect $cbr $sink
  return $cbr
  }



set cbr0 [attach-CBR-traffic $n_(0) $sink_([expr $val(nn)-1]) 512 0.25]
set cbr1 [attach-CBR-traffic $n_(1) $sink_([expr $val(nn)-1]) 512 0.25]




$ns at 0.0 "$cbr0 start"
$ns at $val(stop) "$cbr0 stop"

$ns at 0.0 "$cbr1 start"
$ns at $val(stop) "$cbr1 stop"


$ns at $val(stop) "finish"

puts "Start of simulation.."
$ns run

Code:


 BEGIN {
recvdSize = 0
txsize=0
drpSize=0
startTime = 400
stopTime = 0
thru=0

}

{
event = $1
time = $2
node_id = $3
pkt_size = $8
level = $4

# Store start time
if (level == "AGT" && event =="s" ) {
if (time < startTime) {
startTime = time
}
# hdr_size = pkt_size % 400
#      pkt_size -= hdr_size
# Store transmitted packet's size
txsize++;

}

# Update total received packets' size and store packets arrival time
if (level == "AGT" && event =="r" ) {
if (time > stopTime) {
stopTime = time
}
# Rip off the header
#  hdr_size = pkt_size % 400
# pkt_size -= hdr_size
# Store received packet's size
recvdSize++
# thru=(recvdSize/txsize)
# printf(" %.2f %.2f \n" ,time,thru)>"tru2.tr"

}
if (level == "AGT" && event == "D" ) {
# hdr_size = pkt_size % 400
#      pkt_size -= hdr_size
# Store received packets size
drpSize++

}
}
END {
printf("Average Throughput[kbps] = %.2f\t\ts=%.2f\td=%.2f\tr=%.2fStartTime=%.2f\tStopTime=%.2f\n",(recvdSize/(stopTime-startTime)),txsize,drpSize,recvdSize,startTime,stopTime)

}

Result:
Average Throughput[kbps] = -0.00 StartTime=400.00 StopTime=0.00

Please tell me how to modify the script to get appropriate results!


All times are GMT -5. The time now is 09:53 PM.