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

📄 w-scenario.tcl

📁 对IEEE 802.11e里的分布式信道接入算法EDCA进行改进
💻 TCL
字号:
## A wireless lan scenario with video traffic over udp and background# backlogged traffic### defaultsset pnum 4					;# number of phone streamsset ppktsize 120				;# pktsize of phone streamsset pinterval 10msset vnum 2					;# number of video streamsset vpktsize 2048				;# pktsize of video streamsset vinterval 2msset pktsize 1500				;# pktsize for background trafficset num_nodes 17				;# number of mobilenodes in the scenarioset num_bss_nodes 0				;# adhoc modePLevels set max_plevels_	4PLevels set plevels_		4PHY_MIB set CWMin_0		15PHY_MIB set CWOffset_0		0PHY_MIB set CWMin_1		15PHY_MIB set CWOffset_1		0PHY_MIB set CWMin_2		31PHY_MIB set CWOffset_2		0set difs_1 2set difs_2 7proc create_scenario { } {	global ns_ node_ num_nodes endtime	global pnum ppktsize pinterval	global vnum vpktsize vinterval	global pktsize	incr pnum	incr vnum $pnum	if {$num_nodes < $vnum} {		puts stderr "Bad num_nodes for w-scenario!!!";		exit;	}	set sinknode $node_(0)	set pri 0	# determine the amt of time reqd for the simulation	set endtime [expr 6.0 * ($num_nodes - 1)]	##########################################################	# Setup Phone flows	for {set i 1} {$i < $pnum} {incr i} {		set P		[new Application/Traffic/CBR]		set P_src	[new Agent/UDP]		set P_sink	[new Agent/UDP]		$P set		random_ 0		$P set		packetSize_ $ppktsize		$P set		interval_ $pinterval		$P_src set	packetSize_ $ppktsize		$P_src set	class_ [expr $i + 1] 		$P_src set	prio_ $pri		if {[expr $i % 2] == 0} {			set node_src	$i			set node_sink	0		} else {			set node_src	0			set node_sink	$i		}		$ns_ attach-agent $node_($node_src) $P_src		$ns_ attach-agent $node_($node_sink) $P_sink		$ns_ connect $P_src $P_sink		$P attach-agent $P_src		puts "P$i with pktsize $ppktsize flows from Node$node_src to Node$node_sink every $pinterval"		$ns_ at [expr 3.0 * $i] "$P start"		$ns_ at [expr 3.0 * ($i + $num_nodes - 1)] "$P stop"	}	if {$pnum > 1} {		incr pri	}	##########################################################	# Setup Video flows	for {set i $pnum} {$i < $vnum} {incr i} {		set V		[new Application/Traffic/CBR]		set V_src	[new Agent/UDP]		set V_sink	[new Agent/UDP]		$V set		random_ 0		$V set		packetSize_ $vpktsize		$V set		interval_ $vinterval		$V_src set	packetSize_ $vpktsize		$V_src set	class_ [expr $i + 1] 		$V_src set	prio_ $pri		$ns_ attach-agent $node_($i) $V_src		$ns_ attach-agent $node_(0) $V_sink		$ns_ connect $V_src $V_sink		$V attach-agent $V_src		puts "V$i with pktsize $vpktsize flows from Node$i to Node0 every $vinterval"		$ns_ at [expr 3.0 * $i] "$V start"		$ns_ at [expr 3.0 * ($i + $num_nodes - 1)] "$V stop"set vpktsize 1024set vinterval 3ms	}	if {$vnum > $pnum} {		incr pri	}	##########################################################	# Setup Background flows	for {set i $vnum} {$i < $num_nodes} {incr i} {		if {[expr $i % 2] == 0} {			set agent_src	Agent/TCP			set agent_sink	Agent/TCPSink/DelAck		} else {			set agent_src	Agent/UDP			set agent_sink	Agent/UDP		}		set B		[new Application/FTP]		set B_src	[new $agent_src]		set B_sink	[new $agent_sink]		$B_src		set packetSize_ $pktsize		$B_src		set class_ [expr $i + 1]		$B_src		set prio_ $pri		$ns_ attach-agent $node_($i) $B_src		$ns_ attach-agent $sinknode $B_sink		$ns_ connect $B_src $B_sink		$B attach-agent $B_src		puts "$agent_src B$i with pktsize $pktsize flows from Node$i to Node0"		$ns_ at [expr 3.0 * $i] "$B start"		$ns_ at [expr 3.0 * ($i + $num_nodes - 1)] "$B stop"	}}

⌨️ 快捷键说明

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