cbr-scenario.tcl

来自「NS-2.28的802.11e协议扩展源代码」· TCL 代码 · 共 39 行

TCL
39
字号
#
# A wireless lan scenario with cbr traffic over udp
# 
#

set num_nodes 3		;# number of mobilenodes in the scenario

proc create_scenario { } {
	global ns_ node_

	# Setup traffic flow between nodes
	# UDP connections between node 1 and 2

	set udp1 [new Agent/UDP]
	$udp1 set class_ 2
	$ns_ attach-agent $node_(1) $udp1

	set udp2 [new Agent/UDP]
	$udp2 set class_ 3
	$ns_ attach-agent $node_(2) $udp2

	$ns_ connect $udp1 $udp2

	set cbr1 [new Application/Traffic/CBR]
	$cbr1 attach-agent $udp1
	$cbr1 set packetSize_ 1000
	$cbr1 set interval_ 40ms
	$cbr1 set random_ 0

	set cbr2 [new Application/Traffic/CBR]
	$cbr2 attach-agent $udp2
	$cbr2 set packetSize_ 1000
	$cbr2 set interval_ 40ms
	$cbr2 set random_ 0

	$ns_ at 3.0 "$cbr1 start" 
	$ns_ at 9.0 "$cbr2 start" 
}

⌨️ 快捷键说明

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