CBR流量没有增加

时间:2014-03-21 05:13:11

标签: tcl ns2

ns2-allinone2.34 / ns2.34 / tcl / ex中的wireless-flooding.tcl文件正在成功运行,但其他节点之间没有流量。该程序实现了一个成功运行的简单泛洪。但是当我添加一块代码来生成CBR流量时,错误显示如下:     num_nodes设置为24     初始化列表xListHead

can't read "node_(0)": no such variable
    while executing
    "$ns attach-agent $node_($i) $udp_($j) "
    ("for" body line 3)
    invoked from within
"

for {set i 0} {$i < $num_nodes} {incr i} { 
            set udp_($j) [new Agent/UDP] 
            $ns attach-agent $node_($i) $udp_($j) 
            set null_($j)..."
(file "wireless-flooding.tcl" line 173)

对于CBR流量,我添加了块

set j 0
   for {set i 0} {$i < $num_nodes} {incr i} { 
   set udp_($j) [new Agent/UDP] 
    $ns attach-agent $node_($i) $udp_($j) 
    set null_($j) [new Agent/Null] 
    $ns attach-agent $node_([expr $i+1]) $null_($j) 

     set cbr_($j) [new Application/Traffic/CBR] 
     puts "cbr_($j) has been created over udp_($j)" 
     $cbr_($j) set packet_size_ 512 
     $cbr_($j) set interval_ 1 
     $cbr_($j) set rate_ 10kb 
     $cbr_($j) set ransom_ flase 
     $cbr_($j) attach-agent $udp_($j) 
     $ns connect $udp_($j) $null_($j) 
     puts "$udp_($j) and $null_($j) agents has been connected each other" 
     $ns at 1.0  "$cbr_($j)  start" 

     set j [expr $j+1] 
     set i [expr $i+1] 

 } 

0 个答案:

没有答案