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

📄 vlantest-mcst.tcl

📁 对IEEE 802.11e里的分布式信道接入算法EDCA进行改进
💻 TCL
字号:
source ../lan/vlan.tclset opt(tr)	outset opt(namtr)	"vlantest-mcst.nam"set opt(seed)	0set opt(stop)	0.2set opt(node)	3set opt(qsize)	100yset opt(bw)	20Mbset opt(delay)	1msset opt(ll)	LLset opt(ifq)	Queue/DropTailset opt(mac)	Mac/Csma/Cdset opt(chan)	Channelset opt(tcp)	TCP/Renoset opt(sink)	TCPSinkset opt(source)	FTPproc finish {} {	global ns opt	$ns flush-trace	exec nam $opt(namtr) &	exit 0}proc create-trace {} {	global ns opt	if [file exists $opt(tr)] {		catch "exec rm -f $opt(tr) $opt(tr)-bw [glob $opt(tr).*]"	}	set trfd [open $opt(tr) w]	$ns trace-all $trfd	if {$opt(namtr) != ""} {		$ns namtrace-all [open $opt(namtr) w]	}	return $trfd}proc create-topology {} {	global ns opt	global lan node source node0 nodex nodey	set num $opt(node)	for {set i 0} {$i < $num} {incr i} {		set node($i) [$ns node]		lappend nodelist $node($i)	}	set lan [$ns newLan $nodelist $opt(bw) $opt(delay) \			-llType $opt(ll) -ifqType $opt(ifq) \			-macType $opt(mac) -chanType $opt(chan)]	#$lan addNode $nodelist $opt(bw) $opt(delay)	set node0 [$ns node]	$ns duplex-link $node0 $node(1) 5Mb 2ms DropTail	$ns duplex-link-op $node0 $node(1) orient right	set nodex [$ns node]	$ns duplex-link $nodex $node(2) 5Mb 2ms DropTail	$ns duplex-link-op $nodex $node(2) orient left	set nodey [$ns node]	$ns duplex-link $nodey $node(0) 5Mb 2ms DropTail	$ns duplex-link-op $nodey $node(0) orient down}## MAIN ##set ns [new Simulator -multicast on]$ns color 2 black$ns color 1 blue$ns color 0 red$ns color 30 purple$ns color 31 greenset trfd [create-trace]create-topologyset mproto DMset mrthandle [$ns mrtproto $mproto  {}]set group [Node allocaddr]set udp0 [new Agent/UDP]$ns attach-agent $node0 $udp0set cbr0 [new Application/Traffic/CBR]$cbr0 attach-agent $udp0set rcvrx [new Agent/Null]$ns attach-agent $nodex $rcvrxset rcvry [new Agent/Null]$ns attach-agent $nodey $rcvry$udp0 set dst_ $group$cbr0 set interval_ 0.01$ns at 0.0 "$nodex join-group $rcvrx $group"$ns at 0.0 "$nodey join-group $rcvry $group"$ns at 0.1 "$cbr0 start"$ns at $opt(stop) "finish"$ns run

⌨️ 快捷键说明

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