作者herbert1012 (一定要填喔)
看板Network_Sim
標題[問題] 出現浮點錯誤
時間Thu Sep 8 18:18:59 2011
小弟只是在試試剛安裝好的ns2
結果跑了以下tcl檔
內容是
--------------
#try.tcl
set ns [new Simulator]
$ns color 1 Blue
$ns color 2 Red
set nf [open out.nam w]
$ns namtrace-all $nf
set nd [open out.tr w]
$ns trace-all $nd
set s1 [$ns node]
set s2 [$ns node]
set r [$ns node]
set d [$ns node]
$ns duplex-link $s1 $r 2Mb 10ms DropTail
$ns duplex-link $s2 $r 2Mb 10ms DropTail
$ns duplex-link $r $d 1.7Mb 20ms DropTail
$ns duplex-link-op $s1 $r orient right-down
$ns duplex-link-op $s2 $r orient right-up
$ns duplex-link-op $r $d orient right
$ns duplex-link-op $r $d queuePos 0.5
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $s1 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $d $sink
$ns connect $tcp $sink
$tcp set fid_ 1
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
set udp [new Agent/UDP]
$udp set class_ 1
$ns attach-agent $s2 $udp
set null [new Agent/Null]
$ns attach-agent $d $null
$ns connect $udp $null
$udp set fid_ 2
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 1000
$cbr set random_ false
$ns at 0.1 "$cbr start"
$ns at 1.0 "$ftp start"
$ns at 4.0 "$ftp stop"
$ns at 4.5 "$cbr stop"
$ns at 4.6 "$ns detach-agent $s1 $tcp ; $ns detach-agent $d $sink"
$ns run
-----------------
結果卻跑出
herbert5812@herbert:~/NSfile$ ns try.tcl
浮點數出錯
然後就什麼都沒跑出來
但是怎麼看都看不出端倪阿= =
來請教各位大大解惑!感激不進!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.135.103
推 cassine:通常是發生除以零或是0^0這種錯誤,用gdb抓錯 09/08 20:00
→ herbert1012:找到問題點 是沒有讓程式結束 要加個exit 0 09/09 12:07