LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Aqua-Sim in NS2 (https://www.linuxquestions.org/questions/linux-networking-3/aqua-sim-in-ns2-4175608203/)

Shaveta Kamra 06-19-2017 12:33 PM

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?

knudfl 06-20-2017 06:20 AM

1 Attachment(s)
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.
-

Shaveta Kamra 06-21-2017 12:19 AM

Thanks sir for telling the source node.But still I am unable to determine which node is destination.Can you please help me?

knudfl 06-21-2017 04:03 AM

Re #3.

You can still save the terminal output :
$ ns-aqua vbf_example_4.tcl > 4.txt

Shaveta Kamra 06-21-2017 04:17 AM

Can you send me vbf_example_4.tcl?So that I can better understand

knudfl 06-21-2017 04:54 AM

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

-

Shaveta Kamra 06-21-2017 12:03 PM

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

Shaveta Kamra 06-22-2017 02:20 AM

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

knudfl 06-22-2017 05:01 AM

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 *

-

Shaveta Kamra 06-22-2017 11:54 AM

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!

Shaveta Kamra 06-22-2017 11:57 AM

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

knudfl 06-22-2017 12:48 PM

1 Attachment(s)
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'
-

Shaveta Kamra 06-22-2017 12:52 PM

Thanks so much sir!It works now..

Shaveta Kamra 06-22-2017 01:01 PM

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?

knudfl 06-22-2017 02:06 PM

1 Attachment(s)
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
-


All times are GMT -5. The time now is 09:23 PM.