1.建立一個模擬器物件 (Must)
set ns [new Simulator]
2.開啟一個nam trace 檔案 (Option)
set nf [open out.nam w]
ns namtrace-all $nf
3.宣告一個finish程序(Must)
proc finish{}
{
global ns nf #設nf為全域變數
$ns flush-trace
#close the trace file
close $nf
#execute nam on the trace file
exec nam out.nam &
exit 0
}
data source: http://www.scribd.com/doc/76224756/Network-Simulator-NS-2
沒有留言:
張貼留言