LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-28-2015, 04:28 AM   #1
phucdv11
LQ Newbie
 
Registered: Oct 2014
Posts: 19

Rep: Reputation: Disabled
How to simulate GPSR in ns2.35?


Hello everyone.

I'm using Ns2.35 in ubuntu 14.04.
I want to simulate GPSR routing protocol on it, but it's not work.
Maybe code is wrong (i download it on the internet) or GPSR doesn't work on ns2.35, i think.
this is the code of GPSR.
Code:
# author: Thomas Ogilvie
# sample tcl script showing the use of GPSR and HLS (hierarchical location service)


## GPSR Options
Agent/GPSR set bdesync_                0.5 ;# beacon desync random component
Agent/GPSR set bexp_                   [expr 3*([Agent/GPSR set bint_]+[Agent/GPSR set bdesync_]*[Agent/GPSR set bint_])] ;# beacon timeout interval
Agent/GPSR set pint_                   1.5 ;# peri probe interval
Agent/GPSR set pdesync_                0.5 ;# peri probe desync random component
Agent/GPSR set lpexp_                  8.0 ;# peris unused timeout interval
Agent/GPSR set drop_debug_             1   ;#
Agent/GPSR set peri_proact_            1 	 ;# proactively generate peri probes
Agent/GPSR set use_implicit_beacon_    1   ;# all packets act as beacons; promisc.
Agent/GPSR set use_timed_plnrz_        0   ;# replanarize periodically
Agent/GPSR set use_congestion_control_ 0
Agent/GPSR set use_reactive_beacon_    0   ;# only use reactive beaconing

set opt(bint)           1.0 ;# beacon interval
set opt(use_mac)        1    ;# use link breakage feedback from MAC
set opt(use_peri)       1    ;# probe and use perimeters
set opt(use_planar)     1    ;# planarize graph
set opt(verbose)        1    ;#
set opt(use_beacon)     1    ;# use beacons at all
set opt(use_reactive)   0    ;# use reactive beaconing
set opt(locs)           0    ;# default to OmniLS
set opt(use_loop)       0    ;# look for unexpected loops in peris

set opt(agg_mac)          1 ;# Aggregate MAC Traces
set opt(agg_rtr)          0 ;# Aggregate RTR Traces
set opt(agg_trc)          0 ;# Shorten Trace File


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
set opt(ll)		LL
set opt(ant)		Antenna/OmniAntenna
set opt(x)		1020      ;# X dimension of the topography
set opt(y)		1020      ;# Y dimension of the topography
set opt(ifqlen)		512       ;# max packet in ifq
set opt(seed)		1.0
set opt(adhocRouting)	GPSR      ;# AdHoc Routing Protocol
set opt(nn)		60       ;# how many nodes are simulated
set opt(stop)		300.0     ;# simulation time
set opt(use_gk)		0	  ;# > 0: use GridKeeper with this radius
set opt(zip)		0         ;# should trace files be zipped

set opt(agttrc)         ON ;# Trace Agent
set opt(rtrtrc)         ON ;# Trace Routing Agent
set opt(mactrc)         OFF ;# Trace MAC Layer
set opt(movtrc)         OFF;# Trace Movement


set opt(lt)		""
set opt(cp)		"./cbr/n60/n60_ms15_rate025_size64_seed2"
set opt(sc)		"./scenario/n60/d500_n60_x1020_y1020_h10_l0_p0"

set opt(out)            "result_gpsr.tr"

Agent/GPSR set locservice_type_ 2

Agent/GPSR set bint_                  $opt(bint)
# Recalculating bexp_ here
Agent/GPSR set bexp_                 [expr 3*([Agent/GPSR set bint_]+[Agent/GPSR set bdesync_]*[Agent/GPSR set bint_])] ;# beacon timeout interval
Agent/GPSR set use_peri_              $opt(use_peri)
Agent/GPSR set use_planar_            $opt(use_planar)
Agent/GPSR set use_mac_               $opt(use_mac)
Agent/GPSR set use_beacon_            $opt(use_beacon)
Agent/GPSR set verbose_               $opt(verbose)
Agent/GPSR set use_reactive_beacon_   $opt(use_reactive)
Agent/GPSR set use_loop_detect_       $opt(use_loop)

CMUTrace set aggregate_mac_           $opt(agg_mac)
CMUTrace set aggregate_rtr_           $opt(agg_rtr)

# seeding RNG
ns-random $opt(seed)

# create simulator instance
set ns_		[new Simulator]

set loadTrace  $opt(lt)

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

set tracefd	[open $opt(out) w]

$ns_ trace-all $tracefd

set chanl [new $opt(chan)]

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

# Attach Trace to God
set T [new Trace/Generic]
$T attach $tracefd
$T set src_ -5
$god_ tracetarget $T

#
# Define Nodes
#
puts "AdHoc Routing Protocol ($opt(adhocRouting))"
puts "Configuring Nodes ($opt(nn))"
puts "Time Simulation ($opt(stop))"
$ns_ node-config -adhocRouting $opt(adhocRouting) \
                 -llType $opt(ll) \
                 -macType $opt(mac) \
                 -ifqType $opt(ifq) \
                 -ifqLen $opt(ifqlen) \
                 -antType $opt(ant) \
                 -propType $opt(prop) \
                 -phyType $opt(netif) \
                 -channel $chanl \
		 -topoInstance $topo \
                 -wiredRouting OFF \
		 -mobileIP OFF \
		 -agentTrace $opt(agttrc) \
                 -routerTrace $opt(rtrtrc) \
                 -macTrace $opt(mactrc) \
                 -movementTrace $opt(movtrc)

#
#  Create the specified number of nodes [$val(nn)] and "attach" them
#  to the channel. 
for {set i 0} {$i < $opt(nn) } {incr i} {
    set node_($i) [$ns_ node]
    $node_($i) random-motion 0		;# disable random motion
	set ragent [$node_($i) set ragent_]
	$ragent install-tap [$node_($i) set mac_(0)]

    if { $opt(mac) == "Mac/802_11" } {      
	# bind MAC load trace file
	[$node_($i) set mac_(0)] load-trace $loadTrace
    }

    # Bring Nodes to God's Attention
    $god_ new_node $node_($i)
}

source $opt(sc)

source $opt(cp)

#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $opt(nn) } {incr i} {
    $ns_ at $opt(stop).0 "$node_($i) reset";
}

$ns_ at  $opt(stop).0002 "puts \"NS EXITING... $opt(out)\" ; $ns_ halt"

puts "Starting Simulation..."
$ns_ run
Can you help me,
Thanks for your time.

Last edited by phucdv11; 03-28-2015 at 08:28 AM.
 
Old 03-28-2015, 06:29 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
So where did you get this sketchy old copy of "hls.tcl" ?
A link, please.

The new version of `hls.tcl' : See ns-2.3x/hls/utils/

All GPSR-hls examples : gpsr-hls-examples-05.14.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
130sec-1f-hls-1.tcl
150-2f-hls-2.tcl
AGT-on__hls.tcl
hls.tcl
run.tcl
smac_hls.tcl
smac_ssoumayaa.tcl
ssoumayaa-0.tcl
ssoumayaa-802.15.4.tcl
ssoumayaa.tcl
tes-gpsr.tcl

GPSR info, see posts #2 and #3 here ...
http://www.linuxquestions.org/questi...-4175528835/#2
... And yes, GPSR-hls works OK with ns-2.35 .


! Code must be shown in CODE Tags ...
. http://www.linuxquestions.org/questi....php?do=bbcode
. http://www.linuxquestions.org/questi...gs-4175464257/
I.e. the ` # ' button in the 'Advanced Editor'.
Or type [/code] at code end, and [code] at code start.
* Please edit post #1.
* Editing post #1 : That's the 'Edit' button in post #1.
.... And no bold typing. Bold is for a single word.


-

Last edited by knudfl; 03-28-2015 at 11:34 AM.
 
1 members found this post helpful.
Old 03-28-2015, 08:22 AM   #3
phucdv11
LQ Newbie
 
Registered: Oct 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
#2
thank knudfl,
the link of that GPSR i have downloaded long time ago and i didn't remember.
i will reading that link you give me. thank a lot!
 
Old 03-28-2015, 10:46 AM   #4
phucdv11
LQ Newbie
 
Registered: Oct 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
#2
Dear knudfl
I have sucseccfully run GPSR in ns2 by folow this guid.
Code:
> patch GPSR in ns-2.35 

$ tar xvf ns-allinone-2.35_gcc482.tar.gz ( Patched for gcc-4.8.2 and -4.9.1 ). 
https://drive.google.com/file/d/0B7S255p3kFXNSGJCZ2YzUGJDVk0/view?usp=sharing
$ cd ns-allinone-2.35/ 
$ patch -p0 < GPSR-hls_ns235.patch 
https://drive.google.com/file/d/0B7S255p3kFXNcGFJbGttY2dLT2M/view?usp=sharing
$ ./install 
$ cd ns-2.35/ 
$ cp ns ns-gpsr-hls 
$ sudo cp ns-gpsr-hls /usr/local/bin/ 
... Then you can do: $ ns-gpsr-hls ssoumayaa.tcl 
... from the examples, gpsr-hls-examples-05.14.tar.gz 
https://drive.google.com/file/d/0B7S255p3kFXNVDVyb190WVdyOVE/view?usp=sharing
and this is result
Code:
phuc@ubuntu:~/Desktop/simulation/gpsr-hls-examples-05.14/hls-utils$ ns-gpsr-hls ssoumayaa.tcl 
num_nodes is set 2
INITIALIZE THE LIST xListHead
Starting Simulation...
radiorange 250, x 2000 y 500
length : 3.000000 , cellperline 12 , heigth 1.000000
maxlevel 3
radiorange 250, x 2000 y 500
length : 3.000000 , cellperline 12 , heigth 1.000000
maxlevel 3
SORTING LISTS ...DONE!
can you show me how to run NAM file to see nodes move and communicate with each other.
thank for your time!
Regards!
 
Old 03-28-2015, 11:34 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Nam : $ cd ns-allinone-2.35/nam-1.15/
$ sudo make install

The nam output file from the ssoumayaa.tcl simulation is fangzhen1.nam :
$ nam fangzhen1.nam
... But not much activity. Please try out the other simulation files.

The "scene file" kordinat_20_20.scn for tes-gpsr.tcl is missing in the "05.14 examples".
Please get this new package : gpsr-hls-examples-03.15.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing

-
 
Old 04-02-2015, 11:23 AM   #6
phucdv11
LQ Newbie
 
Registered: Oct 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
#5
Thank you so much!
I am working on it.
 
Old 04-09-2015, 09:54 AM   #7
phucdv11
LQ Newbie
 
Registered: Oct 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
Dear knudfl
I was install another Ns2.35 to instanll GPSR-Keliu on it.
From #2,#3 of this link :http://www.linuxquestions.org/questi...-4175528835/#2
But when i do this: $ns-gpsr-keliu (name).tcl to simulate but it doesn't work.
When i install GPSR-hls, i have download this file be for install : ns-allinone-2.35_gcc482.tar.gz
But, when i install GPSR-KEliu, i didn't see any kind of that file in the link above.

Can you help me for this problem? Thank you so much!
 
Old 04-09-2015, 10:27 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #7.
Quote:
when I install GPSR-Keliu, I didn't see any kind of that file in the link above
? Which link ? Which post ? Which file ?
 
Old 04-09-2015, 11:25 AM   #9
phucdv11
LQ Newbie
 
Registered: Oct 2014
Posts: 19

Original Poster
Rep: Reputation: Disabled
#8
i was download gpsr-keliu-patch from this: #3 http://www.linuxquestions.org/questi...-4175528835/#2

GPSR-KeLiu, ns235
https://drive.google.com/file/d/0B7S...ew?usp=sharing

gpsr-KeLiu_ns235.patch
and i already patch gpsr-keliu on ns2.35, but when i do this: ns-gpsr-keliu <name>.tcl
have the error that: ns-gpsr-keliu command not found
Thanks
 
Old 04-09-2015, 12:35 PM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #9.

The command 'ns-gpsr-keliu' can be used only if you create the file 'ns-gpsr-keliu':
$ cd ns-2.35/
$ cp ns ns-gpsr-keliu
$ sudo cp ns-gpsr-keliu /usr/local/bin/


-
 
Old 11-13-2015, 04:26 PM   #11
ranoucha
LQ Newbie
 
Registered: Nov 2015
Posts: 8

Rep: Reputation: Disabled
Dear knudfl
I try to run GPSR in ns2 but when i use this code
Code: patch -p0 < GPSR-hls_ns235.patch
i have an error which is
bash: GPSR-hls_ns235.patch: No such file or directory
 
Old 11-13-2015, 05:48 PM   #12
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re post #11, @ranoucha : Welcome to LQ.

The easy way : Copy the file GPSR-hls_ns235.patch to ns-allinone-2.35/.
I.e. the patch must be present when using the command $ patch -p0 < GPSR-hls_ns235.patch

(Also possible with $ patch -p0 < /home/ranoucha/Downloads/GPSR-hls_ns235.patch ,,,
if you are keeping the file in Downloads/).

* Build example http://network-simulator-ns-2.7690.n...g-td29371.html


-
 
Old 11-13-2015, 06:31 PM   #13
ranoucha
LQ Newbie
 
Registered: Nov 2015
Posts: 8

Rep: Reputation: Disabled
I did it but when i want to run ssoumayaa.tcl using this code:
ns-gpsr-hls ssoumayaa.tcl

i have

INITIALIZE THE LIST xListHead Starting Simulation... Segmentation fault (core dumped)
 
Old 11-13-2015, 06:48 PM   #14
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #13.

? Which "Linux OS" are you using ?
a) Please show the output from this command : $ uname -m
b) OS name and version, please.

NS-2 is old.
And the latest updates for several OS`s have made some protocols / simulations fail.


-
 
Old 11-13-2015, 07:12 PM   #15
ranoucha
LQ Newbie
 
Registered: Nov 2015
Posts: 8

Rep: Reputation: Disabled
i am using ubuntu 14.04 with ns2.35
 
  


Reply

Tags
gpsr, gpsr-hls, gpsr-keliu#50, ns2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GPSR on ns2.35 nad_y Linux - Software 22 08-07-2015 07:21 AM
[SOLVED] GPSR on NS2.34 farfattou Linux - Software 17 01-10-2015 08:29 AM
gpsr in ns2 navidsal Linux - Software 1 12-05-2014 04:46 AM
[SOLVED] GPSR in ns2 aidin8790 Linux - Software 36 07-05-2014 02:56 AM
Code of GPSR for ns2.33 or ns2.35 monikagoyal Linux - Software 31 04-26-2013 12:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration