Hi Amin, I'm not sure if this will help in this specific case, but try setting - macTrace ON - routerTrace ON
Kind regards Ali Amin Irandoost wrote: >Hi all >I wrote the following code for broadcasting a message in Wireless sensor >network,but i couldn't see any message passing in NAM >please tell me whether or not I can see this event in NAM and Is >broadcasting work truly? >How can I test the VERITY of broadcasting? > >please Help me >i'm waitng for your reply >Thanks in advances > ># ====================================================================== ># Define options ># ====================================================================== > set opt(chan) Channel/WirelessChannel ;# channel type > set opt(prop) Propagation/TwoRayGround ;# radio-propagation model > set opt(ant) Antenna/OmniAntenna ;# Antenna type > set val(ll) LL ;# Link layer type > set opt(ifq) Queue/DropTail/PriQueue ;# Interface queue type > set opt(ifqlen) 500 ;# max packet in ifq > set opt(netif) Phy/WirelessPhy ;# network interface type > set opt(mac) Mac/802_11 ;# MAC type > set opt(nn) 5 ;# number of mobilenodes > set val(rp) DSDV ;# routing protocol > set opt(x) 100 ;# X dimension of the topography > set opt(y) 100 ;# Y dimension of the topography > set opt(stop) 20.0 ;# simulation time > >proc finish {} { > global ns_ f na > $ns_ flush-trace > close $f > close $na > exec nam 1.nam & > exit 0 >} > >set ns_ [new Simulator] > >set f [open 1.tr w] >$ns_ trace-all $f > >set na [open 1.nam w] >$ns_ namtrace-all-wireless $na 100 100 > >set topo [new Topography] >$topo load_flatgrid $opt(x) $opt(y) > >set god_ [create-god $opt(nn)] > >$ns_ node-config -adhocRouting $val(rp) \ > -llType $val(ll) \ > -macType $opt(mac) \ > -ifqType $opt(ifq) \ > -ifqLen $opt(ifqlen) \ > -antType $opt(ant) \ > -propType $opt(prop) \ > -phyType $opt(netif) \ > -channel [new $opt(chan)] \ > -topoInstance $topo \ > -WiredRouting OFF \ > -agentTrace ON \ > -macTrace OFF \ > -movementTrace OFF \ > -routerTrace OFF > > >for { set j 0} { $j < $opt(nn)} {incr j} { > set node_($j) [$ns_ node] > $node_($j) random-motion 0 > } > >$node_(0) set X_ 5 >$node_(0) set Y_ 5 >$node_(1) set X_ 1 >$node_(1) set Y_ 1 >$node_(2) set X_ 9 >$node_(2) set Y_ 9 >$node_(3) set X_ 6 >$node_(3) set Y_ 6 >$node_(4) set X_ 8 >$node_(4) set Y_ 20 > >$ns_ at 0.1 "$node_(0) setdest 70 90 10" >$ns_ at 0.1 "$node_(1) setdest 4 10 10" >$ns_ at 0.1 "$node_(2) setdest 2 90 10" >$ns_ at 0.1 "$node_(3) setdest 40 90 10" >$ns_ at 0.1 "$node_(4) setdest 20 90 10" > >$ns_ color $node_(1) blue ; #why the color is not set??? >$ns_ color $node_(4) red ; #why the color is not set??? > >set udp [new Agent/MessagePassing] >$ns_ attach-agent $node_(1) $udp > >set sink [new Agent/MessagePassing] >$ns_ attach-agent $node_(4) $sink > >set sink1 [new Agent/MessagePassing] >$ns_ attach-agent $node_(0) $sink1 > >set sink2 [new Agent/MessagePassing] >$ns_ attach-agent $node_(2) $sink2 > >set sink3 [new Agent/MessagePassing] >$ns_ attach-agent $node_(3) $sink3 > >$ns_ connect $udp $sink2 ;#do this code is needed for broadcasting???????? >$ns_ connect $udp $sink1 >$ns_ connect $udp $sink >$ns_ connect $udp $sink3 > >$udp set dst_addr_ -1 ;#set destination address -1 for >broadcasting???????????? >$udp set dst_port_ 255 ;#set destination port -255 on DSDV for >broadcasting????????? > >$ns_ at 6.0 "amin" >$ns_ at 7.0 "amin" >$ns_ at 8.0 "amin" > >proc amin {} { >global udp , node_ >for { set i 0 } { $i < 4 } { incr i } { >$udp send 1 {[$node_($i) id]} >;#broadcasting???????????????????? >puts "\nNode [$node_($i) node-addr] send [$node_($i) node-addr] \n" >} >} > > > >for {set i 0} {$i < $opt(nn) } {incr i} { > $ns_ at $opt(stop).000000001 "$node_($i) reset"; >} > > >$ns_ at $opt(stop).00000001 "puts \"NS EXITING...\" ; $ns_ halt" > >$ns_ at 19.99 "finish" > >puts "Starting Simulation..." >$ns_ run > > >