⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eth-lan.tcl

📁 linux平台下1394总线的同步数据传输和异步数据的传输
💻 TCL
字号:
set ns [new Simulator]proc finish {} {        global ns nf tf nf_name tf_name        $ns flush-trace        close $nf        close $tf#        exec ../../../nam-1.0a10/nam $nf_name &        exit 0}proc create-trace-files {num_nodes start_time end_time interval pkt_size} {        global ns nf tf nf_name tf_name        set ival [expr $interval * 1000]    set nf_name "e-$num_nodes-$ival-$pkt_size.nam"    set tf_name "e-$num_nodes-$ival-$pkt_size.tr"    set nf [open $nf_name w]    set tf [open $tf_name w]    $ns namtrace-all $nf    $ns trace-all $tf}proc create-lan {num_nodes start_time end_time interval pkt_size} {    global ns nodes udp cbr null0        # create nodes    for {set i 0} {$i < $num_nodes} {incr i} {	set node($i) [$ns node]	lappend nodelist $node($i)    }    set lan [$ns newLan $nodelist -bw 10Mb -delay 5ms \                -llType LL -ifqType Queue/DropTail -macType Mac/802_3 \                -chanType Channel -phyType Phy/WiredPhy -mactrace false]    set null0 [new Agent/Null]    $ns attach-agent $node(0) $null0        # add agents and applications    for {set j 1} {$j < $num_nodes} {incr j} {        # create UDP agent and attach it to node j        set udp($j) [new Agent/UDP]        $ns attach-agent $node($j) $udp($j)        # create CBR source and attach it to udp        set cbr($j) [new Application/Traffic/CBR]        $cbr($j) set packetSize_ $pkt_size        $cbr($j) set interval_ $interval        $cbr($j) attach-agent $udp($j)                # connect udp agent with null agent        $ns connect $udp($j) $null0                $ns at $start_time "$cbr($j) start"        $ns at $end_time "$cbr($j) stop"    }         return $lan}create-trace-files 2 0.2 0.8 0.005 500create-lan 2 0.2 0.8 0.005 500$ns at 1.0 "finish"$ns run

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -