LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-19-2012, 03:17 AM   #1
r0w225
Member
 
Registered: Jul 2012
Location: South Africa
Distribution: Ubuntu precise pangolin 12.04LTS
Posts: 48

Rep: Reputation: Disabled
random deployment of node in NS2


hi all
i would like to know how to randomly deploy some wireless sensors
nodes in ns2. have been trying and am getting this error /
Code:
num_nodes is set 120
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
wrong # args: should be "set varName ?newValue?"
    while compiling
"set X_ axis [expr rand()*600]"
    ("for" body line 2)
    invoked from within
"for {set i 0} {$i < $val(nn)} { incr i } {
		set X_ axis [expr rand()*600]
		set Y_ axis [expr rand()*500]
$node_($i) set X_$X_ axis
$node_($i) set Y_..."
here is the portion of code that i addes to my scenario
for {set i 0} {$i < $val(nn)} { incr i } {
set X_ axis [expr rand()*600]
set Y_ axis [expr rand()*500]
$node_($i) set X_$X_ axis
$node_($i) set Y_$Y_ axis
$node_($i) set Z_$X_ 0.0
}
i believe it is something simple but i guess i need some coffee i cant see it. thanks
 
Old 09-27-2012, 07:53 AM   #2
flower.Hercules
Member
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
I don't think this is the biggest problem but I'd say you probably need a space in here:

Code:
X_$X_ axis
to look like this:

Code:
 X_ $X_ axis
on each of them.

However, the error leads me to believe your syntax is wrong; specifically the addition of the "axis" after $X_ in the two lines after the for loop. Consider something like this instead:

Code:
for {set i 0} {$i < $val(nn) } { incr i } {
                 set xx [expr rand()*600]
                 set yy [expr rand()*500]
                 $node_($i) set X_ $xx
                 $node_($i) set Y_ $yy
                 $node_($i) set Z_ 0.0
           }

Last edited by flower.Hercules; 09-27-2012 at 07:54 AM.
 
Old 09-28-2012, 07:13 AM   #3
r0w225
Member
 
Registered: Jul 2012
Location: South Africa
Distribution: Ubuntu precise pangolin 12.04LTS
Posts: 48

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by flower.Hercules View Post
I don't think this is the biggest problem but I'd say you probably need a space in here:

Code:
X_$X_ axis
to look like this:

Code:
 X_ $X_ axis
on each of them.

However, the error leads me to believe your syntax is wrong; specifically the addition of the "axis" after $X_ in the two lines after the for loop. Consider something like this instead:

Code:
for {set i 0} {$i < $val(nn) } { incr i } {
                 set xx [expr rand()*600]
                 set yy [expr rand()*500]
                 $node_($i) set X_ $xx
                 $node_($i) set Y_ $yy
                 $node_($i) set Z_ 0.0
           }
Hi ! thanks for the contribution , i solved the problem, some days ago i just forget to close the thread, the syntax was not correct
but moreover i had to declare the variable X_ s a random variable to make it work! now its work fine thanks
 
  


Reply


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
How to change the algorithm of a node in ns2 Swathinag Linux - Software 11 10-04-2016 06:21 AM
the moving direction of the node of ns2 edison_0927 Linux - Newbie 0 08-13-2012 04:41 AM
Doubt in blacklisting of node in ns2 shanmughapriyab Linux - Newbie 0 01-09-2012 02:45 AM
tunnel formation between two malicious node by modifying aodv ns2 indumit18 Linux - Newbie 0 10-28-2011 06:38 AM
Linux Cluster - Random Node Crash ! insanecrac007 Linux - General 0 08-17-2004 11:30 AM


All times are GMT -5. The time now is 06:47 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration