Hi all, I've been doing wireless simulations these days. I want to show NAM to my colleagues to help them to better know about how RTS/CTS reduce the chance of collisions. But I found NAM doesn't display the packet dropped because of collisions. Why? Here is a line of the trace file and the NAM trace file for a packet dropped because of collision:
Trace File Info: d -t 2.267517062 -Hs 2 -Hd -2 -Ni 2 -Nx 700.00 -Ny 200.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw COL -Ma 5fe -Md 2 -Ms 0 -Mt 0 NAM Trace File Info: d -t 2.267517062 -s 2 -d -1 -p RTS -e 44 -c 2 -a 0 -i 0 -k MAC Why doesn't NAM display this dropping action? //////////////////////////////////////////////////////////////////////////// And to be specific, following is my TCL scripts. set opt(RTS) 1 set opt(Time) 20 # ====================================================================== # Default Script valions # ====================================================================== set val(chan) Channel/WirelessChannel ;#Channel Type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 3 ;# number of mobilenodes set val(rp) DSDV ;# routing protocol #set val(rp) DSR ;# routing protocol set val(x) 1000 set val(y) 500 set val(stoptime) $opt(Time) # ====================================================================== # Initialize Global Variables set ns_ [new Simulator] $ns_ use-newtrace if {!$opt(RTS)} { #set RTSThreshold_ to 3000(Larger than any packet size of up level), so RTS wolud never be sent. Mac/802_11 set RTSThreshold_ 3000 ;# bytes puts "Mac/802_11 RTSThreshold_: [Mac/802_11 set RTSThreshold_], RTS/CTS is turned off" set tracefd [open col-hidden.tr w] set namtrace [open col-hidden.nam w] } else { set tracefd [open rts-hidden.tr w] set namtrace [open rts-hidden.nam w] } $ns_ trace-all $tracefd $ns_ namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) # Create God create-god $val(nn) # New API to config node: # 1. Create channel (or multiple-channels); # 2. Specify channel in node-config (instead of channelType); # 3. Create nodes for simulations. # Create channel #1 and #2 set chan_1_ [new $val(chan)] set chan_2_ [new $val(chan)] $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) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace ON \ -movementTrace OFF \ -channel $chan_1_ set node_(0) [$ns_ node] set node_(1) [$ns_ node] set node_(2) [$ns_ node] $node_(0) random-motion 0 $node_(1) random-motion 0 $node_(2) random-motion 0 # # Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes # $node_(0) set X_ 500.0 $node_(0) set Y_ 200.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 300.0 $node_(1) set Y_ 200.0 $node_(1) set Z_ 0.0 $node_(1) label hidden_to_node2 $node_(2) set X_ 700.0 $node_(2) set Y_ 200.0 $node_(2) set Z_ 0.0 $node_(2) label hidden_to_node1 for {set i 0} {$i < $val(nn)} {incr i} { $ns_ initial_node_pos $node_($i) 30 } # Setup traffic flow between nodes 0 and 1 # TCP connections between node_(0) and node_(1) set tcp1 [new Agent/TCP] $tcp1 set class_ 2 set sink1 [new Agent/TCPSink] $ns_ attach-agent $node_(1) $tcp1 $ns_ attach-agent $node_(0) $sink1 $ns_ connect $tcp1 $sink1 set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp1 $ns_ at 0.1 "$ftp1 start" # Setup traffic flow between nodes 0 and 2 # udp connections between node_(0) and node_(2) #set udp [new Agent/UDP] #set null [new Agent/Null] #$ns_ attach-agent $node_(2) $udp #$ns_ attach-agent $node_(0) $null #$ns_ connect $udp $null #set cbr [new Application/Traffic/CBR] #$cbr attach-agent $udp #$ns_ at 0.1 "$cbr start" set tcp2 [new Agent/TCP] $tcp2 set class_ 2 set sink2 [new Agent/TCPSink] $ns_ attach-agent $node_(2) $tcp2 $ns_ attach-agent $node_(0) $sink2 $ns_ connect $tcp2 $sink2 set ftp2 [new Application/FTP] $ftp2 attach-agent $tcp2 $ns_ at 0.1 "$ftp2 start" # # Tell nodes when the simulation ends # for {set i 0} {$i < $val(nn) } {incr i} { $ns_ at $val(stoptime) "$node_($i) reset"; } $ns_ at $val(stoptime) "puts \"FINISHED! NS EXITING...\" ; $ns_ halt" $ns_ at $val(stoptime) "stop" proc stop {} { global ns_ tracefd namtrace $ns_ flush-trace close $tracefd close $namtrace } puts "Starting Simulation..." $ns_ run