[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Nam display errors with wireless mobile nodes
Hello,
I'm doing some simple wireless scenarios and my nam output is giving me
trouble. I have created two scenarios with moving nodes.
In the first, n - 2 nodes are laid out in a straight line and remain fixed,
while the two end nodes (displaced above and below the line) move in a
"jousting" pattern communicating as they move.
In the second, all of the nodes are in a ring topology. The nodes on the
left and right sides of the circle are communicating (using dynamic source
routing), while all nodes move in a sort of "iris" pattern inwards and then
outwards again.
I am experience two different display problems. In both scenarios, the last
node is drawn initially at [0, 0], but once the setdest call is made, the
node jumps to where it *should* be and moves from there. Any reason why the
last of n nodes would appear initially at the wrong location in nam?
The second problem I'm seeing may be a math rounding error, but I can't find
the error. In the ring configuration, if I choose an even number greater
than 10, there is always one node (roughly lower-right portion of circle)
that does not move with the others. If I choose an odd number, however, all
nodes move as expected.
What follows is just the setup portion of the ring topology:
---------------------
set ymid [expr $val(y) / 2.0]
set xmid [expr $val(x) / 2.0]
set radius [expr $val(x) / 2.01]
set pi [expr atan(1.0) * 4]
set leftx 0.01
set lefty 0.01
set rightx [expr $val(x) - 1]
set righty [expr $val(y) - 1]
set speed 40.0
for {set i 0} {$i < $val(nn)} {incr i} {
set x [expr (cos(2 * $pi * ($i / double($val(nn)))) * $radius) + $xmid]
set y [expr (sin(2 * $pi * ($i / double($val(nn)))) * $radius) + $ymid]
$node_($i) set X_ $x
$node_($i) set Y_ $y
$node_($i) set Z_ 0.0
set n [expr int($i + $val(nn) / 3.0) % $val(nn)]
set xdst [expr (cos(2 * $pi * ($n / double($val(nn)))) * $radius) + $xmid]
set ydst [expr (sin(2 * $pi * ($n / double($val(nn)))) * $radius) + $ymid]
$ns_ at 0.02 "$node_($i) setdest $xdst $ydst $speed"
# puts "Node $i ($x $y) -> $n ($xdst $ydst)"
# puts "Node $i at ($x $y)"
# puts "Node $i moving toward location of Node $n"
}
# Hack to get that last node to show up at the right place!
set x [expr (cos(2 * $pi * (($val(nn) - 1) / double($val(nn)))) * $radius) +
$xmid]
set y [expr (sin(2 * $pi * (($val(nn) - 1) / double($val(nn)))) * $radius) +
$ymid]
$ns_ at 0.00000001 "$node_([expr $val(nn) - 1]) setdest $x $y 0.0"
#$ns_ at 0.02 "$node_(0) setdest $leftx $lefty $speed"
#$ns_ at 0.02 "$node_([expr $val(nn) / 2]) setdest $rightx $righty $speed"
# TCP connections between node_(0) and node_(n / 2)
$ns_ color 1 Red
$ns_ color 2 Blue
set tcp [new Agent/TCP]
$tcp set class_ 1
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(0) $tcp
$ns_ attach-agent $node_([expr $val(nn) / 2]) $sink
$ns_ connect $tcp $sink
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.01
$cbr0 attach-agent $tcp
$ns_ at 0.05 "$cbr0 start"
----------------------------------
If you think you can help with this bug, but need to see the entire code,
please e-mail me, and I'll forward everthing to you. By the way, I'm using
nam 1.0a9 because 1.0a10 appears to have become incompatible with 2.1b8a...
Also, is changing the color of the wireless data flows supported in nam? I
tried to change it (as you can see) the same way the tutorial changes flows
on wired links, but the flow color is still black.
Thank you very much for your help!
Jason