Hi,
I have started to work in mobile adhoc networks. I have installed the
ns-allinone-2.27-oolsr-0.99.15.
I wrote one tcl script which tries to connects 2 wireless node using a duplex
link. And I attach a ftp application with one now. I ran the routing protocol
DSDV or OLSR.
Then I run the simulation. It works fine. But when I run the NAM file (.nam)
then it shows 4 nodes instead of 2 nodes, where 2 nodes are wireless node and
2 other nodes are connected with a wired link. And when I play the NAM, it
displays many warning as below.
Warning: Tracefile events are not sorted by time.
+ -t 0.0978399999999999 -s 0 -d 1 -p tcp -e 1040 -c 0 -i 257 -a 0 -x {0.0.0.0
1.0.0.0 137 ------- null}
The above event should occur at or after -t 0.097840.
I have attached my full tcl code here. Appreciate if anyone can help me.
Thanks in advance,
Abdul Awal.
# Load the OOLSR as plugin
#load-plugin ../oolsr-plugin --output $dirName/ns2agent.log multicast route
#packet-drop
#---------------------------------------------------------------------------
# Create a simulation, with wireless support. This is basic (see ns2 doc)
#---------------------------------------------------------------------------
set ns [new Simulator]
set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(ifq) Queue/DropTail/PriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(ifqlen) 50 ;#
set val(nn) 2 ;# nb mobiles
#set val(rp) PLUGINPROTOCOL
set val(rp) DSDV
set val(x) [expr $val(nn) *500.0 + 100.0]
set val(y) 1000
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
set god [create-god $val(nn)]
$ns use-newtrace
set tracefd [open $dirName/unicast.tr w]
$ns trace-all $tracefd
set namtrace [open $dirName/unicast.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
$ns node-config -addressType hierarchical
AddrParams set domain_num_ 2
lappend cluster_num 1 1
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1
AddrParams set nodes_num_ $eilastlevel
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel [new $val(chan)] \
-topoInstance $topo \
-wiredRouting ON \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
#$ns node-config -wiredRouting ON
#---------------------------------------------------------------------------
# Create nodes with OOLSR agent (group 1)
#---------------------------------------------------------------------------
set node0 [$ns node 0.0.0]
$node0 random-motion 0
$node0 set X_ 0.0
$node0 set Y_ 400.0
$node0 set Z_ 0.0
$ns initial_node_pos $node0 20
#---------------------------------------------------------------------------
# Create nodes with OOLSR agent (group 2)
#---------------------------------------------------------------------------
set node2 [$ns node 1.0.0]
$node2 random-motion 0
$node2 set X_ 800.0
$node2 set Y_ 400.0
$node2 set Z_ 0.0
$ns initial_node_pos $node2 20
$ns duplex-link $node0 $node2 10Mb 0.1ms DropTail
#---------------------------------------------------------------------------
# Sending traffic
#---------------------------------------------------------------------------
set sender [new Agent/TCP]
$ns attach-agent $node0 $sender
set ftp [new Application/FTP]
$ftp attach-agent $sender
set receiver [new Agent/TCPSink]
$ns attach-agent $node2 $receiver
$ns connect $sender $receiver
$ns at 0.0 "$ftp start"
#---------------------------------------------------------------------------
# Finishing procedure
#---------------------------------------------------------------------------
proc finishSimulation { } {
global ns node val dirName
$ns flush-trace
# Exit
puts "Finished simulation."
$ns halt
}
#---------------------------------------------------------------------------
# Run the simulation
#---------------------------------------------------------------------------
proc runSimulation {duration} {
global ns finishSimulation
$ns at $duration "finishSimulation"
$ns run
}
runSimulation 10.0
#---------------------------------------------------------------------------