LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 04-14-2015, 12:25 PM   #16
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641

Re #15.

GPSR-KeLiu :
Please have a look at the examples, GPSR-KeLiu-examples_01.2015.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
... to know what's possible to do.
 
Old 04-23-2015, 04:37 AM   #17
whatamazing
LQ Newbie
 
Registered: Mar 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
GPSR-KeLiu :
Please have a look at the examples, GPSR-KeLiu-examples_01.2015.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
... to know what's possible to do.
thank you for your time!
i have something personal to do several days ago, so i didn't check the LQ for a long time.
after i check the link you give. there is only one code in that file that contains a nam. it is the gpsr50.tcl.

it gives me much help but there still have something puzzle me.
when i run the original tcl file ,the xwin hints me with

"
(node 2) association filed -> NO_ACK (beacon enabled)
(node 3) association filed -> NO_ACK (beacon enabled)
..."
an so on.
but the nam runs normal.i don't know whether it has some bad effect to the result.

after that,i delete the other ondes in the code and only leave the node14 to communicate with node0,
but in the nam ,this communication did't happen.
which makes me more confused is that the nam file contains many other communication which i did't see in the code.
such as some communication about node 1 ,etc.
the code and the nam catch is as follows.

Code:
#      20 Jan 2015, @billyfuad / @Muhammed Fuad  ←  mail

set stopTime 50
set BO 3
set SO 3
set speed 1
#speed is in m/s
 #======================================================================
# Default Script valions
# ======================================================================
set opt(chan)		Channel/WirelessChannel
set opt(prop)		Propagation/TwoRayGround
set opt(netif)		Phy/WirelessPhy/802_15_4
set opt(mac)		Mac/802_15_4
set opt(ifq)		Queue/DropTail/PriQueue	
set opt(ll)		LL
set opt(ant)            Antenna/OmniAntenna
set opt(x)		300		;# koordinat X untuk topologi
set opt(y)		300		;# koordinat Y untuk topologi

set opt(ifqlen)		50		;# paket maksimal ifq
set opt(nn)		15		;# jumlah nodes
set opt(seed)		0.0
set opt(stop)		50		;# waktu simulasi
set opt(tr)		gpsr50.tr	;# trace file
set opt(nam)            gpsr50.nam
set opt(rp)             gpsr		;# routing protocol script (Greedy Perimeter Stateless Routing)
set opt(lm)             "off"		;# log movement
set opt(traffic)	cbr             ;# cbr
set opt(energy)         EnergyModel
set opt(AnH)            1.5             ;# Antenna Height
set PI                  3.1415926
set opt(Pt)             25.0 		;# Transmission Power/Range in meters
set opt(initialenergy)  1            ;# Initial energy in Joules
# ======================================================================

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_	60

Queue/DropTail/PriQueue set Prefer_Routing_Protocols    1

# 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


# 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_ 8.91754e-10  ;#sensing range of 200m
Phy/WirelessPhy set RXThresh_ 8.91754e-10  ;#communication range of 200m
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
#Phy/WirelessPhy set Pt_ 2.28289e-11 ;# 500m
# ======================================================================

#yang dihapus new

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]]
	}
}

set appTime1            2.0	;# in seconds 
set appTime2            2.1	;# in seconds 
set appTime3            2.2	;# in seconds 
set appTime4            2.3	;# in seconds 
set appTime5            2.4	;# in seconds 
set stopTime            50	;# in seconds 


#======================================================================
# Parameter untuk 802.11p
#======================================================================

Mac/802_15_4 put-nam-traceall (# nam4wpan #)	;# inform nam that this is a trace file for wpan (special handling needed)
Mac/802_15_4 wpanCmd verbose on
Mac/802_15_4 wpanNam namStatus on	;# default = off (should be turned on before other 'wpanNam' commands can work)
#Mac/802_15_4 wpanNam ColFlashClr gold	;# default = gold
Mac/802_15_4 wpanNam PANCoorClr tomato
Mac/802_15_4 wpanNam CoorClr blue
Mac/802_15_4 wpanNam DevClr green
# For model 'TwoRayGround'
set dist(5m)  7.69113e-06
set dist(9m)  2.37381e-06
set dist(10m) 1.92278e-06
set dist(11m) 1.58908e-06
set dist(12m) 1.33527e-06
set dist(13m) 1.13774e-06
set dist(14m) 9.81011e-07
set dist(15m) 8.54570e-07
set dist(16m) 7.51087e-07
set dist(20m) 4.80696e-07
set dist(25m) 3.07645e-07
set dist(30m) 2.13643e-07
set dist(35m) 1.56962e-07
set dist(40m) 1.20174e-07
set dist(100m) 7.214e-3
set dist(500m) 2.28289e-11

Phy/WirelessPhy set CSThresh_ $dist(500m)
Phy/WirelessPhy set RXThresh_ $dist(500m)


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)]
set chan_1_ [new $opt(chan)]
#
 
proc UniformErr {} {
set erm [new ErrorModel]
$erm unit packet
$erm set rate_ 0.5
$erm ranvar [new RandomVariable/Uniform]
$erm drop-target [new Agent/Null]
return $erm
}


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

#configure node
$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 ON \
			 -movementTrace OFF \
			 -IncomingErrProc UniformErr \
			 -energyModel EnergyModel \
                		-initialEnergy 1 \
                		-rxPower 0.1 \
                		-txPower 0.1\


		
source ./gpsr.tcl
for {set i 0} {$i < $opt(nn) } {incr i} {
    gpsr-create-mobile-node $i
    
}

#=======================================================================
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
#=======================================================================
$node_(0) set X_ 150
$node_(0) set Y_ 300
$node_(0) set Z_ 0
$node_(1) set X_ 75
$node_(1) set Y_ 250
$node_(1) set Z_ 0
$node_(2) set X_ 150
$node_(2) set Y_ 250
$node_(2) set Z_ 0
$node_(3) set X_ 225
$node_(3) set Y_ 250
$node_(3) set Z_ 0
$node_(4) set X_ 50
$node_(4) set Y_ 225
$node_(4) set Z_ 0
$node_(5) set X_ 250
$node_(5) set Y_ 225
$node_(5) set Z_ 0
$node_(6) set X_ 75
$node_(6) set Y_ 150
$node_(6) set Z_ 0
$node_(7) set X_ 150
$node_(7) set Y_ 150
$node_(7) set Z_ 0
$node_(8) set X_ 225
$node_(8) set Y_ 150
$node_(8) set Z_ 0
$node_(9) set X_ 50
$node_(9) set Y_ 75
$node_(9) set Z_ 0
$node_(10) set X_ 75
$node_(10) set Y_ 50
$node_(10) set Z_ 0
$node_(11) set X_ 150
$node_(11) set Y_ 50
$node_(11) set Z_ 0
$node_(12) set X_ 225
$node_(12) set Y_ 50
$node_(12) set Z_ 0
$node_(13) set X_ 250
$node_(13) set Y_ 75
$node_(13) set Z_ 0
$node_(14) set X_ 25
$node_(14) set Y_ 275
$node_(14) set Z_ 0

#=======================================================================
# set mobility file
#=======================================================================


$ns_ at 0.0  "$node_(0) sscs startPANCoord "  ;# startPANCoord <txBeacon=1> <BO=3> <SO=3>
$ns_ at 0.4	"$node_(1) sscs startDevice 1 1 1"
$ns_ at 0.5	"$node_(2) sscs startDevice 1 1 1"
$ns_ at 0.6	"$node_(3) sscs startDevice 1 1 1"
$ns_ at 0.7	"$node_(4) sscs startDevice 1 1 1"
$ns_ at 0.8	"$node_(5) sscs startDevice 1 1 1"
$ns_ at 0.9	"$node_(6) sscs startDevice 1 1 1"
$ns_ at 1.0	"$node_(7) sscs startDevice 1 1 1"
$ns_ at 1.1	"$node_(8) sscs startDevice 1 1 1"
$ns_ at 1.2	"$node_(9) sscs startDevice 1 1 1"
$ns_ at 1.3	"$node_(10) sscs startDevice 1 1 1"
$ns_ at 1.4	"$node_(11) sscs startDevice 1 1 1"
$ns_ at 1.5	"$node_(12) sscs startDevice 1 1 1"
$ns_ at 1.6	"$node_(13) sscs startDevice 1 1 1"
$ns_ at 1.7	"$node_(14) sscs startDevice 0"

Mac/802_15_4 wpanNam PlaybackRate 3ms
$ns_ at $appTime1 "puts \"\nTransmitting data ...\n\""



# Setup traffic flow between nodes
proc cbrtraffic { src dst interval starttime } {
   global ns_ node_
   set udp_($src) [new Agent/UDP]
   eval $ns_ attach-agent \$node_($src) \$udp_($src)
   set null_($dst) [new Agent/Null]
   eval $ns_ attach-agent \$node_($dst) \$null_($dst)
   set cbr_($src) [new Application/Traffic/CBR]
   eval \$cbr_($src) set packetSize_ 50
   eval \$cbr_($src) set rate_ 50k
   eval \$cbr_($src) set interval_ $interval
   eval \$cbr_($src) set random_ 0
   eval \$cbr_($src) attach-agent \$udp_($src)
   eval $ns_ connect \$udp_($src) \$null_($dst)
   $ns_ at $starttime "$cbr_($src) start"
}
# yang dihapus
if {"$opt(traffic)" == "cbr"} {
   puts "\nTraffic: cbr"
   #Mac/802_15_4 wpanCmd ack4data on
   puts [format "Acknowledgement for data: %s" [Mac/802_15_4 wpanCmd ack4data]]
   $ns_ at $appTime1 "Mac/802_15_4 wpanNam PlaybackRate 0.50ms"
   $ns_ at [expr $appTime1 + 0.5] "Mac/802_15_4 wpanNam PlaybackRate 1.5ms"
   cbrtraffic 14 0 0.6 50




   $ns_ at $appTime1 "$ns_ trace-annotate \"(at $appTime1) cbr traffic from node 14 to node 0\""

   Mac/802_15_4 wpanNam FlowClr -p GPSR -c tomato
   Mac/802_15_4 wpanNam FlowClr -p ARP -c black
   Mac/802_15_4 wpanNam FlowClr -p MAC -c navy
   Mac/802_15_4 wpanNam FlowClr -p cbr -s 14 -d 0 -c black

}

# defines the node size in nam
for {set i 0} {$i < $opt(nn)} {incr i} {
     $ns_ initial_node_pos $node_($i) 20
}

# Tell nodes when the simulation ends
for {set i 0} {$i < $opt(nn) } {incr i} {
    $ns_ at $stopTime "$node_($i) reset";
}
$ns_ at $stopTime "stop"
$ns_ at $stopTime "puts \"\nNS EXITING...\n\""
$ns_ at $stopTime "$ns_ halt"
proc stop {} {
    global ns_ tracefd appTime opt env
    $ns_ flush-trace
    close $tracefd
    set hasDISPLAY 0
    foreach index [array names env] {
        #puts "$index: $env($index)"
        if { ("$index" == "DISPLAY") && ("$env($index)" != "") } {
                set hasDISPLAY 1
        }
    }
    if { ("$opt(nam)" == "gpsr50.nam") && ("$hasDISPLAY" == "1") } {
    	#exec nam gpsr50.nam &
	#exec awk -f energy.awk gpsr50.tr &
		    }
}
puts "\nStarting Simulation..."
$ns_ run
Attached Thumbnails
Click image for larger version

Name:	catch.JPG
Views:	41
Size:	65.0 KB
ID:	18213  
 
Old 04-25-2015, 08:27 AM   #18
whatamazing
LQ Newbie
 
Registered: Mar 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Re #16.

I find something wrong in the gpsr ptotocol.
Code:
$ns_ at 0.0  "$node_(0) NodeLabel PAN Coor"
$ns_ at 0.0  "$node_(0) sscs startPANCoord "  ;# startPANCoord <txBeacon=1> <BO=3> <SO=3>
the code that make a label to node_0, but in the nam file it makes the node_1 instead.
what's more, the whole communication period in the file looks like take node_1 as coordinater.
that may explain part of what i post in #17.

Last edited by whatamazing; 04-25-2015 at 08:29 AM.
 
  


Reply

Tags
gpsr, greedy, ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] to run TCL script on ns2 for udp lite protocol sakibamu Linux - Software 2 01-03-2014 01:30 AM
NS2: regarding error during run .tcl file bhupendrapatel Linux - Software 4 05-03-2013 09:32 AM
[SOLVED] Floating point exception after run TCL script ns2 deVacto Linux - Newbie 7 10-28-2012 11:56 PM
how to link tcl file and C++ files together and run in ns2? tootz Linux - Software 3 07-25-2012 03:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

All times are GMT -5. The time now is 10:01 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