LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to patch GPSR routing protocol to ns-2.34 (https://www.linuxquestions.org/questions/linux-software-2/how-to-patch-gpsr-routing-protocol-to-ns-2-34-a-878526/)

nimacasino 05-03-2011 05:44 AM

How to patch GPSR routing protocol to ns-2.34
 
Hey guys!

I need to patch the GPSR routing protocol to ns-2.34 (ns-allinone-2.34), but i dont know how. could anyone help me, please?

Thank you all in advance for your time

knudfl 05-03-2011 06:19 AM

Welcome to LQ.

I don't know of any "GPSR routing protocol patch" for ns-2.34.
The available patches are for ns-2.29 and ns-2.33
http://www.cn.uni-duesseldorf.de/alu.../hls-ns2-patch

Suggest : Start with ns-allinone-2.33, and when everything works,
you can give ns-2.34 a try. ( It may work ? )


It is no problem having 2 .. 8 different ns-allinone-2.xx installed
at the same time. But do not add any of them to a path :
Is usually not required since ns-2.26.

..

nimacasino 05-03-2011 08:37 AM

@ knudfl
 
first of all thank you for your kind

Dear Knudfl, problem solved!
I handled this problem using the guidance of this webpage : http://www.cs.binghamton.edu/~kliu/r...ode/index.html
It worked and now i am happy. :)

magnetpest2k5 06-09-2011 12:44 PM

Hi nimacasino,

I also did install gpsr in ns2.34 and the included example works fine. But when I just include gpsr as routing protocol in my own simulation code it give plenty of errors. I guess I have to include many tcl parameters for the gpsr to work. Can you help me out with this?

Thank You
Vineeth

parastoo 06-19-2011 12:33 PM

hi guys
I have the same problem, would u plz give me a direct link to download patch gpsr for ns2.34, i couldnt use the websites above to solving my problem to downloading this patch...
tnx alot
Parastoo

itishi00 12-25-2011 07:12 AM

Want to measure mobility
 
dear nimacasino,

Can you please tell me the steps for using gpsr in ns2?
I am new to ns2 and want tot simulate mobility.

can you please guide me for that....if possible pls send some notes or code on my id itishi00@yahoo.com


Thanks in advance

VANET_Prasad 01-05-2012 07:54 PM

GPSR on NS 2.33
 
Hi,

I have successfully integrated the Ke Liu's GPSR implementation in to NS-2.33 and the
example which he has given for 100 stationary nodes are working fine and the packet delivery
ration is 100%.

When I tried this code for 50 mobile nodes then it does not work properly. The sources keep dropping packets
and for CBR connections the packet delivery ratio becomes as low as 10% at times.

has anyone tried this before!! Any one knows how to make this properly! I have spent lot of time
on this please help me if you can!

Cheers
Prasad

yashu 02-08-2012 09:13 AM

hi
 
can anybody help me patching gpsr in ns2.34
please help me

knudfl 02-08-2012 09:21 AM

Post #7, @yashu.

You can have as many versions of ns-allinone-2.xx as you want,
installed at the same time. But do not any of them to a *PATH.

The latest gpsr patches are for ns-2.33 only.

.

yashu 02-08-2012 09:30 AM

ok , i installed ns2.33, tried to execute , code is not complete, could u help me

knudfl 02-08-2012 10:53 AM

Post #10.

Which Ubuntu version are you using ? ?
And what is it you can't get to work ?
http://www.linuxquestions.org/linux/...Ask_a_Question
http://linuxsilo.net/docs/smart-questions_en.html



http://www.cn.uni-duesseldorf.de/alu.../hls-ns2-patch
> ns2.33-hls-patch.tar.gz > ns-2.33-hls.patch

1) cd ns-allinone-2.33/2.33/ && patch -p1 < ns-2.33-hls.patch
2) cd ../ && ./install : No errors.
EDIT : Ubuntu : Please see post # 23.

.

muaz.sh 03-06-2012 12:54 PM

Dear All,
As I found this is the only thread on the internet discussing the integration of GPSR with ns-2.34, so please let us lock it successfully. I have tried and modified many files of ns2 and Ke Liu`s implementation following the steps as nimacasino mentioned, after recompilation every thing goes well, but when I applied GPSR over the nodes, in nam these nodes do not move, any suggestion to solve this?
Regards,

mdkhasawneh 03-09-2012 08:48 PM

Hello

im new to NS2 and im working on VANET

i need to work on GPSR routing protocol

i found this topic very useful

i need help in getting source code for GPSR and how to patch

if possible anyone to help me in doing that and give me the steps

knudfl 03-11-2012 12:55 PM

Post #13, @mdkhasawneh : Welcome to LQ.

Please read post # 11. And follow the link to the ns-2.33-hls.patch.

mdkhasawneh 03-11-2012 05:50 PM

thanks knudfl

i follow the steps in Post #11

but i get many errors and later this error

make:***[trace/cum-trace.o] error 1
Ns make failed!

can you please help me to solve this error

muaz.sh 03-11-2012 07:03 PM

Hi there
I am using ns2.34 the following steps are workable to include Keliu GPSR implementation which could be downloaded from http://www.cs.binghamton.edu/~kliu/r...ode/index.html:
1- follow the three steps you find in the readme, but at step "2" you need to follow "or sentence" i.e you need to modify the files rather than replace them, here you will find some structural difference between Keliu files and ns2.34 files but all you need to do is to do the simple modifications which are mentioned within step "2" of the readme.txt file
2- after you performe step 3 i.e recompilation of ns2.34 "it should be error free" then you can test wireless-gpsr.tcl
3- if you want to get workable nam file i.e. with moving nodes rather than constant ones replace the following for loop:
for {set i 0} {$i < $opt(nn) } {incr i} {
gpsr-create-mobile-node $i
}
with this one:
for {set i 0} {$i < $opt(nn) } {incr i} {
gpsr-create-mobile-node $i
$node_($i) namattach $namfile #This command is used to attach the namtrace file descriptor <namtracefd> to the mobilenode. All nam traces for the node are then written into this namtrace file.
}

I also replaced the following command:
$ns_ namtrace-all $namfile
with this one:
$ns_ namtrace-all-wireless $namfile $opt(x) $opt(y)

I hope this helps all who need to integrate GPSR with ns2.34

muaz.sh 03-11-2012 07:04 PM

Hi there
I am using ns2.34 the following steps are workable to include Keliu GPSR implementation which could be downloaded from http://www.cs.binghamton.edu/~kliu/r...ode/index.html:
1- follow the three steps you find in the readme, but at step "2" you need to follow "or sentence" i.e you need to modify the files rather than replace them, here you will find some structural difference between Keliu files and ns2.34 files but all you need to do is to do the simple modifications which are mentioned within step "2" of the readme.txt file
2- after you performe step 3 i.e recompilation of ns2.34 "it should be error free" then you can test wireless-gpsr.tcl
3- if you want to get workable nam file i.e. with moving nodes rather than constant ones replace the following for loop:

for {set i 0} {$i < $opt(nn) } {incr i} {
gpsr-create-mobile-node $i
}
with this one:
for {set i 0} {$i < $opt(nn) } {incr i} {
gpsr-create-mobile-node $i
$node_($i) namattach $namfile #This command is used to attach the namtrace file descriptor <namtracefd> to the mobilenode. All nam traces for the node are then written into this namtrace file.
}

I also replaced the following command:
$ns_ namtrace-all $namfile
with this one:
$ns_ namtrace-all-wireless $namfile $opt(x) $opt(y)

I hope this helps all who need to integrate GPSR with ns2.34

mdkhasawneh 03-12-2012 11:31 AM

Dear muaz.sh can you help me

i add the patch for GPSR in Ns 2.33 and no errors

but when i run the command

ns hls.tcl

i get the following error

invalid command name "Agent/GPSR"
while executing
"Agent/GPSR set bdesync_ 0.5 "
(file "hls.tcl" line 6)

knudfl 03-12-2012 01:53 PM

# 18 : cd ns-allinone-2.33/ns-2.33/hls/utils/ && ./ns hls.tcl
Code:

num_nodes is set 40
Configuring Nodes (40)
INITIALIZE THE LIST xListHead
Starting Simulation...
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
radiorange 250, x 2000 y 2000
length : 3.000000 , cellperline 12 , heigth 3.000000
maxlevel 3
SORTING LISTS ...DONE!
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
        _o31: no target for slot 0
        _o31 type: Classifier/Port
content dump:
classifier _o31
        0 offset
        0 shift
        2147483647 mask
        1 slots
                slot 255: _o33 (CMUTrace/Recv)
---------- Finished standard no-slot{} default handler ----------


mdkhasawneh 03-12-2012 11:20 PM

Dear knudfl i did the command

cd ns-allinone-2.33/ns-2.33/hls/utils/ && ./ns hls.tcl

but after it run i get the error

invalid command name "Agent/GPSR"
while executing
"Agent/GPSR set bdesync_ 0.5 "
(file "hls.tcl" line 6)

is there is any solution for this error?

knudfl 03-12-2012 11:31 PM

# 20

The ns-2.33 build with the patch is very easy ,,, see post # 11.

Either you are using an unpatched 'ns'. Or your build failed.

Which OS are you using ? ? Version ? Read the links, also post # 11.
Is it 32bits ? 64bits ? The 'uname -m' command will tell.

.

mdkhasawneh 03-12-2012 11:51 PM

Dear knudfl im using ubunto 10.04 from Vbox

i run uname -m command and it give me i686

is this mean 64-bit?

and if it 64-bit how can i install 32-bit on my machine.

thnaks,

knudfl 03-13-2012 01:38 AM

# 22 : i686 is 32bits = The best choice.
I had the usual issues with the Ubuntu patch command (ns2 patches.)
An exit with no errors, but not all files were in the right location.
→ The missing files can be unpacked from "hls-files-ns233.tar.gz":
https://docs.google.com/open?id=0B7S...alV2SGhJdk1hQQ

This worked on Ubuntu 10.04 : sudo apt-get install g++-4.1

cd ns-allinone-2.33/ns-2.33/ && patch -p1 < ns-2.33-hls.patch
&& tar xvf hls-files-ns233.tar.gz && cd ../
&& export CC=gcc-4.1 CXX=g++-4.1 && ./install


hls.tcl : cd ns-allinone-2.33/ns-2.33/hls/utils/ && ../../ns hls.tcl
→ An OK result. Almost identical to post # 19.

.

sonasanam 03-13-2012 06:55 AM

hi
 
hi

Am working on vanet routing , i want to change MAC layer to 802.11p,
can u help to include this into my tcl file

muaz.sh 03-13-2012 08:36 AM

Dear mdkhasawneh,
I did not try to use ns2.33 and the patch you use.However; I guess you did not install the patch correctly, because this error is the same as you did not include the header file of gpsr, so the compiler will not find the command. I suggest you reinstall the patch following steps mentioned in the Readme file strictly.

mdkhasawneh 03-13-2012 01:42 PM

Quote:

Originally Posted by knudfl (Post 4625437)
# 22 : i686 is 32bits = The best choice.
I had the usual issues with the Ubuntu patch command (ns2 patches.)
An exit with no errors, but not all files were in the right location.
→ The missing files can be unpacked from "hls-files-ns233.tar.gz":
https://docs.google.com/open?id=0B7S...alV2SGhJdk1hQQ

This worked on Ubuntu 10.04 : sudo apt-get install g++-4.1

cd ns-allinone-2.33/ns-2.33/ && patch -p1 < ns-2.33-hls.patch
&& tar xvf hls-files-ns233.tar.gz && cd ../
&& export CC=gcc-4.1 CXX=g++-4.1 && ./install


hls.tcl : cd ns-allinone-2.33/ns-2.33/hls/utils/ && ../../ns hls.tcl
→ An OK result. Almost identical to post # 19.

.

Dear knudfl i follow your provided steps and now ns hls.tcl is working

can you help me to run GPSR using NAM

i want to have animation for the protcol.

mdkhasawneh 03-14-2012 11:54 PM

Dear muaz.sh i applied the steps in post # 17

to Keliu GPSR implementation but after run ns wireless-gpsr.tcl

i get this:

num_nodes is set 100
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
GPSR configuration file
INITIALIZE THE LIST xListHead
Loading connection pattern...
Loading scenario file...
Load complete...
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 129.2
SORTING LISTS ...DONE!
NS EXITING...

and also nothing showed on the screen no animation.

is there is anything missing in my code i already modify wireless-gpsr.tcl accourding to post #17.

knudfl 03-15-2012 05:04 AM

#27

Some tcl files will include a command to open a nam window.

All other tcl scripts, that create an <out.nam> file :
Nam is to be run afterwards : nam out.nam

mdkhasawneh 03-15-2012 05:19 AM

Dear knudfl how can i modify wireless-gpsr.tcl to run nam animation

i will post the content of the tcl file:

Code:

# Copyright (c) 1997 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#      This product includes software developed by the Computer Systems
#      Engineering Group at Lawrence Berkeley Laboratory.
# 4. Neither the name of the University nor of the Laboratory may be used
#    to endorse or promote products derived from this software without
#    specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Header: /home/cvs/repository/kliu/ns2/gpsr/wireless-gpsr.tcl,v 1.8 2005/12/01 00:03:17 kliu Exp $
#
# Ported from CMU/Monarch's code, nov'98 -Padma.




# ======================================================================
# Default Script Options
# ======================================================================
set opt(chan)                Channel/WirelessChannel
set opt(prop)                Propagation/TwoRayGround
set opt(netif)                Phy/WirelessPhy
set opt(mac)                Mac/802_11
set opt(ifq)                Queue/DropTail/PriQueue        ;# for dsdv
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)                "./cbr100.tcl"
set opt(sc)                "./grid-deploy10x10.tcl"

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

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

LL set mindelay_                50us
LL set delay_                        25us
LL set bandwidth_                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 freq_ 914e+6
Phy/WirelessPhy set L_ 1.0


# The transimssion radio range
#Phy/WirelessPhy set Pt_ 6.9872e-4    ;# ?m
Phy/WirelessPhy set Pt_ 8.5872e-4    ;# 40m
#Phy/WirelessPhy set Pt_ 1.33826e-3  ;# 50m
#Phy/WirelessPhy set Pt_ 7.214e-3    ;# 100m
#Phy/WirelessPhy set Pt_ 0.2818      ;# 250m
# ======================================================================

# Agent/GPSR setting
Agent/GPSR set planar_type_  1  ;#1=GG planarize, 0=RNG planarize
Agent/GPSR set hello_period_  5.0 ;#Hello message period

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

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
#
#        puts ABC
#        if { $tracefd == "" } {
#                return ""
#        }
#        puts BCD
#        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 ../tcl/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
# ======================================================================
#
# 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 ../tcl/lib/ns-cmutrace.tcl
source ../tcl/lib/ns-bsnode.tcl
source ../tcl/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]
$ns_ trace-all  $tracefd

set namfile [open $opt(nam) w]
$ns_ namtrace-all-wireless $namfile $opt(x) $opt(y)

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

$prop topography $topo

#
# Create God
#
set god_ [create-god $opt(nn)]


#
#  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)
#

$ns_ node-config -adhocRouting gpsr \
                -llType $opt(ll) \
                -macType $opt(mac) \
                -ifqType $opt(ifq) \
                -ifqLen $opt(ifqlen) \
                -antType $opt(ant) \
                -propType $opt(prop) \
                -phyType $opt(netif) \
                -channelType $opt(chan) \
                -topoInstance $topo \
                -agentTrace ON \
                -routerTrace ON \
                -macTrace OFF \
                -movementTrace OFF

source ./gpsr.tcl

for {set i 0} {$i < $opt(nn) } {incr i} {
    gpsr-create-mobile-node $i
    $node_($i) namattach $namfile
}


#
# 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..."

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

$ns_ at $opt(stop) "finish"

$ns_ run


knudfl 03-15-2012 05:51 AM

Post #29 : Please hit the 'Edit' button in post #29 and edit to CODE Tags.
Write [/code] at code text end, and [code] at code start.
Or use the # button in the 'Advanced Editor'.


Post # 17 indicates that a nam file should be generated.

Why not use that file ? ? nam <file.nam>

.

mdkhasawneh 03-15-2012 06:00 AM

Dear knudfl im totaly new to NS2

for this reason i post the tcl to get help in modifying the file to run NAM.

can you tell me what to do?

muaz.sh 03-15-2012 11:37 AM

@27 this message refers that you have successfully integrated the GPSR implementation with ns2. in order to run nam animation, wireless-gpsr.tcl puts the traces files in the same folder, these files are trace.tr and nam.out.tr, so if you need to run the animation of this file you need to use the terminal and execute this command:
nam nam.out.tr

mdkhasawneh 03-15-2012 11:48 AM

Dear muaz.sh after execute this command:
nam nam.out.tr

and by play the nam i get this in terminal and nothing at nam

muaz.sh 03-15-2012 11:58 AM

are you sure you did not modify the wireless-gpsr.tcl or any other file?

mdkhasawneh 03-15-2012 12:11 PM

Dear muaz.sh i just modify wireless-gpsr.tcl accourding to post #17

can you send me the correct wireless-gpsr.tcl for runing the nam?

muaz.sh 03-16-2012 03:46 AM

Dear mdkhasawneh,
nam is just an another program like ns, so if you need to run it you must call it from shell: nam <nam trace file>, or you can run it from within tcl script by this command: exec nam <nam trace file>

muaz.sh 03-16-2012 10:06 AM

In order to surpass the problem of "node X is not defined" you need to add this loop after the definition of the nodes i.e after if { $opt(sc) == "" } statement:

for {set i 0} {$i < $opt(nn) } {incr i} {
$ns_ initial_node_pos $node_($i) 10
}
where
$ns_ initial_node_pos node size
command defines the node initial position in nam. <size> denotes the size of node in nam. This function must be called after mobility model has been defined.

Menik 03-18-2012 06:19 PM

Hi nimacasino,
Could you please let me know how did you fix GPSR for NS2.34 ?
I am also referring the link. However, thanking you if you can explain it in steps.
Thanks in advance !

Menik 03-18-2012 10:40 PM

HI Mauz.sh,

Are the steps mentioned in #16 are valid for NS2.35 as well ?
I am getting an error when i type "ns wireless-gpsr.tcl". Any help ?

mdkhasawneh 03-19-2012 07:39 AM

Hello i run GPSR Successfully from Keliu GPSR implementation.
when i run nam nam.out.tr i can see the radio range for nodes and transmission but the nodes are static and not moving. is this ok or nodes can be moving also.

i have another problem in understanding the trace file format from nam.out.tr to represent the result in grapgh.

it look different from the trace file format at

http://www.cs.binghamton.edu/~kliu/r...ode/index.html

i will attache some data from nam.out.tr and please if anyone can understand the format explain for me.

Code:


r -t 0.060020077 -s 30 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 13 -k RTR
r -t 0.060020077 -s 21 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 13 -k RTR
r -t 0.060020104 -s 11 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 13 -k RTR
r -t 0.060020104 -s 31 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 13 -k RTR
r -t 0.060020143 -s 0 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 13 -k RTR
r -t 0.060020143 -s 40 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 13 -k RTR
r -t 0.060020143 -s 22 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 13 -k RTR
+ -t 0.068286028 -s 40 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
- -t 0.068286028 -s 40 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
h -t 0.068286028 -s 40 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482095 -s 30 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482095 -s 50 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482095 -s 41 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482123 -s 31 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482123 -s 51 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482162 -s 20 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482162 -s 60 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
r -t 0.069482162 -s 42 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 14 -k RTR
+ -t 0.088690801 -s 58 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 15 -k RTR
- -t 0.088690801 -s 58 -d -1 -p gpsr -e 29 -c 2 -a 0 -i 15 -k RTR

where the format at http://www.cs.binghamton.edu/~kliu/r...ode/index.html

look like

Code:


s 76.000000000 _98_ AGT  --- 1812 cbr 32 [0 0 0 0] ------- [98:0 0:0 32 0]
r 0.010176954 _9_ RTR  --- 1 gpsr 29 [0 ffffffff 8 800] ------- [8:255 -1:255 32 0]


Menik 03-19-2012 03:42 PM

Hi
When I run the same code with modifications ia m getting a run time error. mdkhasawneh, which NS2 version you are running and on which platform ? Thanks in advance.
I am geting below runtime error for ns wireless-gpsr.tcl

* glibc detected * ns: free(): invalid next size (fast): 0x08ede2f0 ***
======= Backtrace: =========
/lib/libc.so.6[0x5646c5]
/lib/libc.so.6(cfree+0x59)[0x564b09]
/lib/libc.so.6[0x51bf12]
/lib/libc.so.6[0x51ac83]
/lib/libc.so.6(setlocale+0x178)[0x51a688]
ns[0x84d63ff]
ns[0x8464965]
ns(Tcl_FindExecutable+0x17)[0x84600d7]
ns(Tcl_Main+0x32)[0x84942e2]
ns(nslibmain+0x20)[0x8413de2]
ns(main+0x22)[0x8413e3e]
/lib/libc.so.6(__libc_start_main+0xdc)[0x510e9c]
ns(__gxx_personality_v0+0x37d)[0x819b8b1]
======= Memory map: ========
00200000-00201000 r-xp 00200000 00:00 0 [vdso]
004c6000-004d1000 r-xp 00000000 fd:00 3209017 /lib/libgcc_s-4.1.2-20080825.so.1
004d1000-004d2000 rwxp 0000a000 fd:00 3209017

PRINCY 03-22-2012 11:12 AM

Hi,

I have patched the Ke Liu's GPSR implementation in NS-2.34 ..but the nodes are not moving in nam....can any one help me ?

Menik 03-25-2012 07:25 AM

Hi All,
Can anyone please explain how to get x, y coordinates on C++ code
?
If anyone could please letme know a place I can find atleast an example.

Thanks

Menik 03-27-2012 04:24 PM

Hi All,
If anyone who is familier with the GPSR protocol and if you know how they print the X Y coordinates please explain how they have done it.
I know it uses MobileNode.h hearder and call functions in that class.
But from where do we pass the nodes to the C++ class ?
Because most of the wireless examples (e.g. AODV), we define the adhoc routing protocol when configure the node.

Please help me.
Thanks,

Menik 04-03-2012 12:46 AM

HI All,
Is there anyone who is working on WSN. I have some questions tobe clarified. Please send me an email to menikt@gmail.com and we can have a
discussion.
Thanks

Menik 04-08-2012 09:58 PM

Error With GPSR
 
HI ALL,
If anyone solve this error.
Please Let me know how ? Thanks

invalid command name "Agent/GPSR"
while executing
"Agent/GPSR set planar_type_ 1 "
(file "wireless-gpsr.tcl" line 112)

monikagoyal 04-09-2012 06:17 AM

I m using ns2.33 on fedora 14.

I m trying the same way u told bt i m getting the error:
patch: **** rejecting target file name with ".." component: ../ns-2.33-hls_working/ns-2.33/common/agent.h

Quote:

Originally Posted by knudfl (Post 4597147)
Post #10.

Which Ubuntu version are you using ? ?
And what is it you can't get to work ?
http://www.linuxquestions.org/linux/...Ask_a_Question
http://linuxsilo.net/docs/smart-questions_en.html



http://www.cn.uni-duesseldorf.de/alu.../hls-ns2-patch
> ns2.33-hls-patch.tar.gz > ns-2.33-hls.patch

1) cd ns-allinone-2.33/2.33/ && patch -p1 < ns-2.33-hls.patch
2) cd ../ && ./install : No errors.
EDIT : Ubuntu : Please see post # 23.

.


monikagoyal 04-09-2012 06:19 AM

I m also getting the same error.

Plz help me if u got any solution. I really want to implement it as soon as possible.
Anyone plz help regarding this error.
Quote:

Originally Posted by Menik (Post 4648001)
HI ALL,
If anyone solve this error.
Please Let me know how ? Thanks

invalid command name "Agent/GPSR"
while executing
"Agent/GPSR set planar_type_ 1 "
(file "wireless-gpsr.tcl" line 112)


monikagoyal 04-09-2012 08:36 AM

Hi nimacasino

As u said u have successfully installed gpsr on ns2.34, can u plz help me with the running code of gpsr for ns2.33 or ns2.34 or ns2.35.
I have installed all of these on diff systems.

Plz mail me the code as soon as possible.
It'll be a great help.
I hope u can understand my problem.
Plz mail me at: goyal.monika23@gmail.com
Quote:

Originally Posted by nimacasino (Post 4345060)
first of all thank you for your kind

Dear Knudfl, problem solved!
I handled this problem using the guidance of this webpage : http://www.cs.binghamton.edu/~kliu/r...ode/index.html
It worked and now i am happy. :)


Menik 04-10-2012 01:44 AM

GPSR error
 
HI monikagoyal,
Did you solve the error ?
If you have done so please let me know how. It will be a great help
Thanks,


All times are GMT -5. The time now is 10:28 PM.