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

📄 simple.tcl

📁 跑leach需要的
💻 TCL
字号:
set ns [new Simulator]$ns color 0 blue$ns color 1 red$ns color 2 whiteset n0 [$ns node]set n1 [$ns node]set n2 [$ns node]set n3 [$ns node]set f [open out.tr w]$ns trace-all $fset nf [open out.nam w]$ns namtrace-all $nf$ns duplex-link $n0 $n2 5Mb 2ms DropTail$ns duplex-link $n1 $n2 5Mb 2ms DropTail$ns duplex-link $n2 $n3 1.5Mb 10ms DropTail$ns duplex-link-op $n0 $n2 orient right-up$ns duplex-link-op $n1 $n2 orient right-down$ns duplex-link-op $n2 $n3 orient right$ns duplex-link-op $n2 $n3 queuePos 0.5set udp0 [new Agent/UDP]$ns attach-agent $n0 $udp0set cbr0 [new Application/Traffic/CBR]$cbr0 attach-agent $udp0set udp1 [new Agent/UDP]$ns attach-agent $n3 $udp1$udp1 set class_ 1set cbr1 [new Application/Traffic/CBR]$cbr1 attach-agent $udp1set null0 [new Agent/Null]$ns attach-agent $n3 $null0set null1 [new Agent/Null]$ns attach-agent $n1 $null1$ns connect $udp0 $null0$ns connect $udp1 $null1$ns at 1.0 "$cbr0 start"$ns at 1.1 "$cbr1 start"set tcp [new Agent/TCP]$tcp set class_ 2set sink [new Agent/TCPSink]$ns attach-agent $n0 $tcp$ns attach-agent $n3 $sink$ns connect $tcp $sinkset ftp [new Application/FTP]$ftp attach-agent $tcp$ns at 1.2 "$ftp start"$ns at 1.35 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"puts [$cbr0 set packetSize_]puts [$cbr0 set interval_]$ns at 3.0 "finish"proc finish {} {	global ns f nf	$ns flush-trace	close $f	close $nf	puts "running nam..."	exec nam out.nam &	exit 0}$ns run

⌨️ 快捷键说明

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