I am trying to broadcast from a single node source without receiver. I changed the broadcast code that i found in ns-allinone-2.34/ns-2.34/tcl/ex/802.11/broadcast_validation.tcl by removing the for loop. Can anyone help me explain why it goes for an infinite loop?
The code: #~/ns-allinone-2.35/ns-2.35/tcl/ex/802.11/IEEE802-11p.tcl #802.11p default parameters source IEEE802-11p.tcl #static number of cars and the dimension (area) set ncars 1 set val(x) 2000 set val(y) 200 #set val(z) 0 set val(stop) 1 set val(chan) Channel/WirelessChannel #set val(modIndex) [lindex $argv 0] set modIndex 0 puts "mod Index used is $modIndex" #===================================================================== set pktsize 500; #Assumed size in bytes #set comRange 80; #Communication Range in meters #puts "# of cars is $ncars" puts "TCL Payload Size: $pktsize bytes" #puts "comRange is: $comRange meters" # Main Program # Initialize Global Variables #http://nshubforum.com/category/Network-simulation for $defaultRNG seed n global defaultRNG $defaultRNG seed 1 set ns_ [new Simulator] #set tracefd [open trace.tr w] set tracefd stdout #set namtrace [open wirelessout.nam w] $ns_ trace-all $tracefd #$ns_ namtrace-all-wireless $namtrace $val(x) $val(y) #$ns_ use-newtrace set topo [new Topography] $topo load_flatgrid $val(x) $val(y) #Creating the General Operations Director object set god_ [create-god $ncars] #$god_ off #To minimize warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl #set wirelesschan [new $val(chan)] #BEFORE creating a wireless node you MUST first select (configure) the node configuration parameters to "become" a wireless $ns_ node-config -llType LL \ -macType Mac/802_11Ext \ -ifqType Queue/DropTail/PriQueue \ -ifqLen 50 \ -phyType Phy/WirelessPhyExt \ -adhocRouting DSDV \ -propType Propagation/TwoRayGround \ -antType Antenna/OmniAntenna \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace OFF #Creating nodes equal to value of ncars for {set i 0} {$i < $ncars} {incr i} { set node_($i) [$ns_ node] $node_($i) random-motion 0; #disable random motion } #initialize node location for {set i 0} {$i < $ncars} {incr i} { set xx [expr ($i+1)*10] $node_($i) set x_ $xx $node_($i) set y_ 50 #$node_($i) set z_ 0.0 } set lane 1;#number of lanes in the scenario #set channel_ [new RandomVariable/Normal] #set channel_ 6 #$channel_ set max_ 6 #$channel_ set min_ 0 #Indexing vehicles set index 0 $node_($index) set X_ [expr $i * 10] $node_($index) set Y_ 50 #$node_($index) set Z_ 0 set agent_($index) [new Agent/PBC] $ns_ attach-agent $node_($index) $agent_($index) $agent_($index) set modulationScheme_ $modIndex $agent_($index) set interval_ 0.1 $agent_($index) set packetSize_ $pktsize #$agent_($index) set Pt_ 1e-4 $agent_($index) set payloadSize 1000 $agent_($index) set peroidcaBroadcastInterval 0.2 $agent_($index) set peroidcaBroadcastVariance 0.05 $agent_($index) set modulationScheme 1 $agent_($index) PeriodicBroadcast ON $ns_ at $val(stop).1 "$node_($index) reset"; for {set i 0} {$i < 1} {incr i} { set txtime_ [new RandomVariable/Uniform] $txtime_ set max_ 0.01 $txtime_ set min_ 0 #Specify the packetType (0 = safety, 1 = service) #For Service Type packet, you need to specify the channel number (0 to 5) #ForSafety Type packet, you have to set the channel number to -99. $agent_($i) set channel_ -99 $agent_($i) set type_dsrc_ 0 $ns_ at [$txtime_ value] "$agent_($i) reset" } #$ns_ at 1.0 $ns_ run -- *Regards,* *Pratik*