I'm trying to orient the nodes in ns2 using angles. It's not working. What am I doing wrong?
set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf
set n 4
set router1 [$ns node]
set router2 [$ns node]
$ns duplex-link $router1 $router2 45Mb 75ms DropTail
set x_sndr 50
set x_rcvr 300
set offset 45
set angle [expr -1*$offset*$n/2]
$ns duplex-link-op $router1 $router2 orient right
for {set i 1} {$i <= $n} {incr i} {
set sndr($i) [$ns node]
set rcvr($i) [$ns node]
$ns duplex-link $router1 $sndr($i) 10Mb 10ms DropTail
$ns duplex-link $router2 $rcvr($i) 10Mb 10ms DropTail
set angle [expr $angle+$offset]
puts "$angle"
$ns duplex-link-op $router2 $rcvr($i) orient ($angle)
$ns duplex-link-op $sndr($i) $router1 orient (-1*$angle)
}
$ns duplex-link-op $router1 $router2 orient right
$ns
close $
exec nam out.
exit 0
In the for loop I'm setting duplex-link-op to orient in a particular way, using angles. No matter what values I put for angles, the orientation does not change.
Finally answering my own question,
The documentation of NS2/NAM is not proper and does not properly tell how to use angles as attributes to orient the links.
As shown on this page, it just says this
But in reality you need to orient by appending the word deg to the angle value
Eg:
$ns duplex-link-op orient 90
should be$ns duplex-link-op orient 90deg
So the code will be as follows: