官方淘宝店 易迪拓培训 旧站入口
首页 > 无线通信 > 通信技术学习讨论 > 请教一个NS脚本为什么没有生成流量,谢谢

请教一个NS脚本为什么没有生成流量,谢谢

12-10
trace 文件为空
# tcl
set ns [new Simulator]
set n1 [$ns node]
set n2 [$ns node]
set n0 [$ns node]
set n3 [$ns node]
# define link
$ns duplex-link $n0 $n1 100Mb 2ms DropTail
$ns duplex-link $n1 $n2 15Mb 10ms RED
$ns queue-limit $n2 $n1 250
$ns queue-limit $n1 $n2 250
$ns duplex-link $n3 $n2 100Mb 3ms DropTail
# set nodes' position
$ns duplex-link-op $n0 $n1 orient right
# set nodes' position
$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n1 $n2 orient right
$ns duplex-link-op $n1 $n2 queuePos 0
$ns duplex-link-op $n2 $n1 queuePos 0
$ns duplex-link-op $n3 $n2 orient left
#set tcp source
#set tcp0 [$ns create-connection TCP/Reno $n0 TCPSink $n3 0]
#$tcp0 set window_ 15
#set ftp0 [$tcp0 attach-source FTP]
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
$ns connect $udp0 $null0
#Tracing a link
set tracefd [open twoflow.tr w]
$ns trace-all $tracefd
set namfd [open twoflow.nam w]
$ns namtrace-all $namfd
$ns at 0.5 "$cbr0 start"
$ns at 1 "$cbr0 stop"
$ns at 1.5 "finish"
# Define 'finish' procedure
proc finish {} {
        global ns tracefd namfd
        $ns flush-trace
        close $tracefd
        close $namfd
        exec nam twoflow.nam &
        exit 0
}
$ns run

没有node config?

node config 是默认的啊

Top