LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-19-2017, 12:33 PM   #1
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Rep: Reputation: Disabled
Aqua-Sim in NS2


Hello Sir,

system descriptions: Aqua-Sim-1.0, ns-2.30, ubuntu 16.4 32 bits

I run vbf_example_5.tcl..It works ok. But in nam i cannot able to know which node is source and which node is destination.There is no clear distinction between source and destination node.Some circulation is showing which shows transmission is happening.Can you help me sir?
 
Old 06-20-2017, 06:20 AM   #2
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
It's rather easy to mark nodes with text, etc.

"vbf_example_4.tcl" (New name for the edited vbf_example_5.tcl)

.... source node:

Code:
   276	#Set the source node
   277	set node_($total_number) [$ns_  node $total_number]
   278	$god_ new_node $node_($total_number)
   279	
   280	$node_($total_number) set  sinkStatus_ 1
   281	
   282	$node_($total_number) set X_  490
   283	$node_($total_number) set Y_  10
   284	$node_($total_number) set Z_  40
   285	$node_($total_number) set-cx  200
   286	$node_($total_number) set-cy  0
   287	$node_($total_number) set-cz  0
   288	set rt [$node_($total_number) set ragent_]
   289	$rt set control_packet_size  $opt(routing_control_packet_size)
   290	
   291	# --------------------------------- added label -------------
   292	$ns_ at 0.0 "$node_($total_number) label SOURCE"
   293	$ns_ at 0.0 "$node_($total_number) add-mark m1 blue circle"
   294	# -----------------------------------------------------------
   295
Line 291 .. 294 was added.
-
Attached Thumbnails
Click image for larger version

Name:	4vbf_example_4.nam.jpg
Views:	29
Size:	7.5 KB
ID:	25284  

Last edited by knudfl; 06-20-2017 at 06:33 AM.
 
1 members found this post helpful.
Old 06-21-2017, 12:19 AM   #3
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Thanks sir for telling the source node.But still I am unable to determine which node is destination.Can you please help me?
 
Old 06-21-2017, 04:03 AM   #4
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 #3.

You can still save the terminal output :
$ ns-aqua vbf_example_4.tcl > 4.txt
 
1 members found this post helpful.
Old 06-21-2017, 04:17 AM   #5
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Can you send me vbf_example_4.tcl?So that I can better understand
 
Old 06-21-2017, 04:54 AM   #6
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 #5.

vbf_example_4.tcl, as post #2 ... and vbf_example_3.tcl: nodes 0-4 turn red →
aquasim-examples-Jun21.17.tar.gz
→ → https://drive.google.com/file/d/0B7S...ew?usp=sharing

All ns2-examples https://drive.google.com/drive/folde...Ws?usp=sharing

-
 
1 members found this post helpful.
Old 06-21-2017, 12:03 PM   #7
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Thanks sir for providing me links. But again sir there is no label which tells which node is destination like in aodv protocol examples we can see label of both source and destination.I can see source node label from coding of vbf_example_3.tcl and 4vbf_example_4.tcl but please sir can you tell me destination node label?


Is below coding is for destination node?
#Set the Sink node


set node_(0) [ $ns_ node 0]
$node_(0) set sinkStatus_ 1
$god_ new_node $node_(0)
$node_(0) set X_ 500
$node_(0) set Y_ 0
$node_(0) set Z_ 0
$node_(0) set passive 1

set rt [$node_(0) set ragent_]
$rt set control_packet_size $opt(routing_control_packet_size)


set a_(0) [new Agent/UWSink]
$ns_ attach-agent $node_(0) $a_(0)
$a_(0) attach-vectorbasedforward $opt(width)
$a_(0) cmd set-range $opt(range)
$a_(0) cmd set-target-x -20
$a_(0) cmd set-target-y -10
$a_(0) cmd set-target-z -20
$a_(0) cmd set-filename $opt(datafile)
$a_(0) cmd set-packetsize $opt(packet_size) ;# # of bytes
 
Old 06-22-2017, 02:20 AM   #8
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Hello Sir,

Can you provide links for learning or understanding tcl programming so that i can understand how traffic is generated and flow of data taken place? As i am confused with agent and application i.e traffic source generator.And there is same agent which is used in tcl for aquasim like UWSink is attached to almost all nodes.How this work can take place?

Please help sir...
 
Old 06-22-2017, 05:01 AM   #9
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 #8.

Ns2: Not really the tcl language, but OTcl: Object oriented extension of Tcl
. https://www.isi.edu/nsnam/otcl/doc/tutorial.html
. http://nile.wpi.edu/NS/otcl.html
Tcl https://www.google.com/webhp?hl=all&...q=tcl+tutorial
OTcl https://www.google.com/webhp?hl=all&...l#hl=en&q=otcl


I do not write tcl or otcl code, but can use 'grep' to find expressions in the other 2000 simulation examples
https://drive.google.com/file/d/0B7S...ew?usp=sharing
← "Catalog link" https://drive.google.com/drive/folde...Ws?usp=sharing
... and copy useful bits of text : Do and try.

The post #2 edits are based on "aodv10ms.tcl", "aodv10nodes.tcl".
$ man grep
$ grep -n red *
$ grep -n blue *

-
 
1 members found this post helpful.
Old 06-22-2017, 11:54 AM   #10
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Thanks sir for your help but these links are not besides to my work.If you found something related to communication set up between nodes kindly share with me. I Will be thankful to you!
 
Old 06-22-2017, 11:57 AM   #11
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Hello Sir,

In vbf_example_5.tcl I have increased a no.of nodes by 1 means total nodes are 7 in my modified tcl..but when i increase it gave me errors:

shaveta@shaveta-Aspire-4738Z:~/Aqua-Sim-1.0/ns-2.30/underwatersensor/uw_tcl$ ns-aquasim vbf_example_5.tcl
the file name is vbf_example_5.data
the sending interval is 10.0
num_nodes is set 7
Width=100
INITIALIZE THE LIST xListHead
can't read "a_(5)": no such element in array
while executing
"$a_($i) set data_rate_ [expr 1.0/$opt(interval)]"
("for" body line 2)
invoked from within
"for { set i 1 } { $i<$opt(nn) } {incr i } {
$a_($i) set data_rate_ [expr 1.0/$opt(interval)]
$ns_ at $start_time "$a_($i) cbr-start"
set start_time..."
(file "vbf_example_5.tcl" line 303)


Changes in code:
set opt(nn) 7 ;# number of nodes (change 7 from 6 in code)

Please help me
 
Old 06-22-2017, 12: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,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #11 : No automatic settings of nodes in vbf_example_4.tcl .. vbf_example_5.tcl .

Which means that the settings must be written for each node :
See vbf_example_5.tcl, lines 142 .. 272 : That's node 0 to node 4.
Easy : Copy "the node 4 section" to below "the node 4 section" and edit all 4 to 5. Set X,Y to your preferred location.

New file name : vbf_example_4-7n.tcl
Code:
   271	$a_(4) cmd set-packetsize $opt(packet_size) ;# # of bytes
   272	
   273	# ----------- Add node 5 --------------------------------
   274	
   275	set node_(5) [ $ns_  node 5]
   276	$node_(5) set sinkStatus_ 1
   277	$node_(5) random-motion 1
   278	
   279	$node_(5) set max_speed $opt(maxspeed)
   280	$node_(5) set min_speed $opt(minspeed)
   281	$node_(5) set position_update_interval_ $opt(position_update_interval)
   282	
   283	$god_ new_node $node_(5)
   284	$node_(5) set X_  400
   285	$node_(5) set Y_  20
   286	$node_(5) set Z_  30
   287	$node_(5) set passive 1
   288	
   289	set rt [$node_(5) set ragent_]
   290	$rt set control_packet_size  $opt(routing_control_packet_size)
   291	
   292	set a_(5) [new Agent/UWSink]
   293	$ns_ attach-agent $node_(5) $a_(5)
   294	$a_(5) attach-vectorbasedforward $opt(width)
   295	$a_(5) cmd set-range $opt(range) 
   296	$a_(5) cmd set-target-x -20
   297	$a_(5) cmd set-target-y -10
   298	$a_(5) cmd set-target-z -20
   299	$a_(5) cmd set-filename $opt(datafile)
   300	$a_(5) cmd set-packetsize $opt(packet_size) ;# # of bytes
   301	
   302	# -------------------------------------------------------
   303	
   304	#Set the source node
Link, vbf_example_4-7n.tcl https://drive.google.com/file/d/0B7S...ew?usp=sharing'
-
Attached Thumbnails
Click image for larger version

Name:	Aquawhite__vbf4-7.jpg
Views:	27
Size:	3.3 KB
ID:	25297  

Last edited by knudfl; 06-22-2017 at 01:09 PM.
 
2 members found this post helpful.
Old 06-22-2017, 12:52 PM   #13
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Thanks so much sir!It works now..
 
Old 06-22-2017, 01:01 PM   #14
Shaveta Kamra
Member
 
Registered: Jun 2017
Posts: 39

Original Poster
Rep: Reputation: Disabled
Exclamation

Hello Sir,

Now I am running vbf_example_6.tcl..This tcl consists of 100 nodes and in this every node is not separately defined. One node define and other nodes are put in loops.Almost all coding is similar to vbf_example_5.tcl. But when i run vbf_example_6.tcl nam window just opens and nodes are moving only without doing any transmission. I am unable to know why transmission between nodes do not takes place?
 
Old 06-22-2017, 02:06 PM   #15
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 #14.
Quote:
why transmission between nodes do not takes place
The examples are not supposed to be perfect. But ... :

You can experiment with filters → vbf_example_7.tcl
Code:
#set opt(filters)       GradientFilter    ;# options can be one or more of 
                                	  ;# TPP/OPP/Gear/Rmst/SourceRoute/Log/TagFilter
# ----------------------------------------
#set opt(filters)	TPP
#set opt(filters)	SourceRoute	
#set opt(filters)	Gear
#set opt(filters)	Log/TagFilter
set opt(filters)	TPP/OPP/Gear/Rmst/SourceRoute/Log/TagFilter	
# ----------------------------------------
And set the source node color
Code:
#Set the source node
set node_(1) [$ns_  node 1]
$god_ new_node $node_(1)

$node_(1) set  sinkStatus_ 1

$node_(1) set max_speed $opt(maxspeed)
$node_(1) set min_speed $opt(minspeed)
$node_(1) set position_update_interval_ $opt(position_update_interval)

$node_(1) set X_  100
$node_(1) set Y_  300
$node_(1) set Z_  $opt(z)
$node_(1) set-cx  100
$node_(1) set-cy  300
$node_(1) set-cz  $opt(z)
set rt [$node_(1) set ragent_]
#$rt set control_packet_size  $opt(routing_control_packet_size)

# -------------- added label --------------------------------
$ns_ at 0.0 "$node_(2) label SOURCE"
$ns_ at 0.0 "$node_(2) add-mark m1 blue circle"
# -----------------------------------------------------------
$ns_ at 2.0 "$node_(1) move"
Extend the time
Code:
set opt(stop)		1000	;# simulation time
set opt(prestop)        900     ;# time to prepare to stop
... in order to get some more data :
Code:
$ ns-aqua vbf_example_7.tcl > vbf7.txt
... showing the transmission.
Link, vbf_example_7.tcl https://drive.google.com/file/d/0B7S...ew?usp=sharing
-
Attached Files
File Type: txt vbf7.txt (2.2 KB, 39 views)
 
1 members found this post helpful.
  


Reply

Tags
aquasim, 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
Aqua-Sim in NS2 Shaveta Kamra Linux - Newbie 4 06-13-2017 01:35 AM
Aqua-Sim in NS2 Shaveta Kamra Linux - Newbie 3 06-07-2017 11:01 AM
Aqua-Sim in NS2 Shaveta Kamra Linux - Wireless Networking 1 06-07-2017 06:02 AM
aqua sim in ns2 - DBR protocol saye_s Linux - Software 71 03-04-2017 09:19 AM
NS2 and Aqua-sim Faiza Al-Salti Linux - Networking 3 06-12-2014 12:46 AM

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

All times are GMT -5. The time now is 07:24 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
Open Source Consulting | Domain Registration