0

いくつかの手順を実行する方法はありますか?このようにしないでください:

set tcp [new Agent/TCP/Newreno]
set sink [new Agent/TCPSink]
$ns attach-agent $n(0) $tcp
$ns attach-agent $n(1) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 1.0 "$ftp start" 
$ns at 130.0 "$ftp stop" 
##################################################################
set tcp [new Agent/TCP/Newreno]
set sink [new Agent/TCPSink]
$ns attach-agent $n(6) $tcp
$ns attach-agent $n(15) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 10.0 "$ftp start" 
$ns at 110.0 "$ftp stop" 
##################################################################
set tcp [new Agent/TCP/Newreno]
set sink [new Agent/TCPSink]
$ns attach-agent $n(8) $tcp
$ns attach-agent $n(0) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 30.0 "$ftp start" 
$ns at 100.0 "$ftp stop" 

何度も?私はこのようなことをします:

    proc wymiana {ns n_varname w1 w2 t1 t2} {
    upvar 1 $n_varname n

    set tcp [new Agent/TCP/Newreno]
    set sink [new Agent/TCPSink]
    $ns attach-agent $n($w1) $tcp
    $ns attach-agent $n($w2) $sink
    $ns connect $tcp $sink
    set ftp [new Application/FTP]
    $ftp attach-agent $tcp
    $ns at t1 "$ftp start" 
    $ns at t2 "$ftp stop" 
}

wymiana $ns  n  1 2 1.0 100.0

しかし、うまくいきません... NAM には伝送がありません。どうしてか分かりません。助けてください。

4

1 に答える 1