[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wireless LAN
I am experiencing some trouble to simulate a wireless LAN
using ns-2. The code for Mac/802.11 seems to be incomplete,
because the simulator complains about variables that do not
exist. If I use Csma/Ca as a Mac type, the simulator runs
normally but I cannot start the nam application.
The Tcl script that I am using to simulate follows this text.
If anyone has a tip about this issue, please send an answer.
Thanks in advance.
Flavio Paiva.
############## Source code mob.tcl
#source ~/NS/fontes/linux/ns/tcl/lan/ns-mac.tcl
#source ~/NS/fontes/linux/ns/tcl/lan/ns-lan.tcl
#set env(PATH) "${nshome}bin:$env(PATH)"
set ns [new Simulator]
Simulator set EnableMcast_ 1
Simulator set NumberInterfaces_ 1
set f [open out.tr w]
$ns trace-all $f
set namf [open out.nam w]
$ns namtrace-all $namf
$ns color 1 red
# prune/graft packets
$ns color 30 purple
$ns color 31 bisque
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n2 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n3 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n4 1.5Mb 10ms DropTail
$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n1 $n3 orient right
$ns duplex-link-op $n1 $n4 orient right-down
set lan [$ns make-lan "$n3 $n5" 10Mb 10ms LL Queue/DropTail Mac/Csma/Ca Channel]
set mproto pimDM
set mrthandle [$ns mrtproto $mproto {}]
set cbr0 [new Agent/CBR]
$ns attach-agent $n0 $cbr0
$cbr0 set dst_ 0x8001
set rcvr [new Agent/LossMonitor]
$ns attach-agent $n3 $rcvr
$ns at 0.0 "$cbr0 start"
$ns at 0.3 "$n3 join-group $rcvr 0x8001"
$ns at 1.2 "$n2 join-group $rcvr 0x8001"
$ns at 2.0 "finish"
proc finish {} {
global ns
$ns flush-trace
puts "running nam..."
exec nam out.nam &
exit 0
}
$ns run