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

📄 test-suite-smac.tcl

📁 跑leach需要的
💻 TCL
📖 第 1 页 / 共 3 页
字号:
Test/unicast8 instproc run {} {    $self next}Test/unicast8_sync instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast8_sync    set opt(nn) 4    $self next    $node_(1) set X_ 300.0    $node_(1) set Y_ 300.0    $node_(1) set Z_ 0.0        $node_(0) set X_ 150.0    $node_(0) set Y_ 150.0    $node_(0) set Z_ 0.0        # node 2 can hear 1 & 3    $node_(2) set X_ 450.0    $node_(2) set Y_ 450.0    $node_(2) set Z_ 0.0    # node 3 hears only 2    $node_(3) set X_ 600.0    $node_(3) set Y_ 600.0    $node_(3) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(3) $ping3    # connect two agents    $ns_ connect $ping2 $ping3        # start times for both connections    $ns_ at 40.1 "$ping1 send"    #sender cannot hear other tx    $ns_ at 60.1 "$ping2 send"    }Test/unicast8_sync instproc run {} {    $self next}Test/unicast9 instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast9    set opt(nn) 4    $self next    $node_(0) set X_ 300.0    $node_(0) set Y_ 300.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 150.0    $node_(1) set Y_ 150.0    $node_(1) set Z_ 0.0        # node 2 & 3 cannot  hear 0 & 1    $node_(2) set X_ 500.0    $node_(2) set Y_ 550.0    $node_(2) set Z_ 0.0    $node_(3) set X_ 650.0    $node_(3) set Y_ 680.0    $node_(3) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(3) $ping3    # connect two agents    $ns_ connect $ping2 $ping3        # start times for both connections    $ns_ at 0.1 "$ping0 send"    #sender cannot hear other tx    $ns_ at 0.1 "$ping3 send"    }Test/unicast9 instproc run {} {    $self next}Test/unicast9_sync instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast9_sync    set opt(nn) 4    $self next    $node_(0) set X_ 300.0    $node_(0) set Y_ 300.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 150.0    $node_(1) set Y_ 150.0    $node_(1) set Z_ 0.0        # node 2 & 3 cannot  hear 0 & 1    $node_(2) set X_ 500.0    $node_(2) set Y_ 550.0    $node_(2) set Z_ 0.0    $node_(3) set X_ 650.0    $node_(3) set Y_ 680.0    $node_(3) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(3) $ping3    # connect two agents    $ns_ connect $ping2 $ping3        # start times for both connections    $ns_ at 40.1 "$ping0 send"    #sender cannot hear other tx    $ns_ at 60.1 "$ping3 send"    }Test/unicast9_sync instproc run {} {    $self next}Test/unicast10 instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast10    set opt(nn) 4    $self next    $node_(0) set X_ 100.0    $node_(0) set Y_ 100.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 50.0    $node_(1) set Y_ 50.0    $node_(1) set Z_ 0.0        # node 2 & 3 cannot  hear 0 & 1    $node_(2) set X_ 500.0    $node_(2) set Y_ 550.0    $node_(2) set Z_ 0.0    $node_(3) set X_ 650.0    $node_(3) set Y_ 680.0    $node_(3) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(3) $ping3    # connect two agents    $ns_ connect $ping2 $ping3        # start times for both connections    $ns_ at 0.1 "$ping0 send"    #sender cannot hear other tx    $ns_ at 0.1 "$ping3 send"    }Test/unicast10 instproc run {} {    $self next}Test/unicast10_sync instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast10_sync    set opt(nn) 4    $self next    $node_(0) set X_ 100.0    $node_(0) set Y_ 100.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 50.0    $node_(1) set Y_ 50.0    $node_(1) set Z_ 0.0        # node 2 & 3 cannot  hear 0 & 1    $node_(2) set X_ 500.0    $node_(2) set Y_ 550.0    $node_(2) set Z_ 0.0    $node_(3) set X_ 650.0    $node_(3) set Y_ 680.0    $node_(3) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(3) $ping3    # connect two agents    $ns_ connect $ping2 $ping3        # start times for both connections    $ns_ at 40.1 "$ping0 send"    #sender cannot hear other tx    $ns_ at 40.1 "$ping3 send"    }Test/unicast10_sync instproc run {} {    $self next}Test/unicast11 instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast11    set opt(nn) 3    $self next    $node_(0) set X_ 100.0    $node_(0) set Y_ 100.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 200.0    $node_(1) set Y_ 200.0    $node_(1) set Z_ 0.0        $node_(2) set X_ 300.0    $node_(2) set Y_ 100.0    $node_(2) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping3    # connect two agents    $ns_ connect $ping2 $ping3    set ping4 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping4    set ping5 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping5    # connect two agents    $ns_ connect $ping4 $ping5        # start times for connections    $ns_ at 0.1 "$ping0 send"    $ns_ at 0.1 "$ping2 send"    $ns_ at 0.1 "$ping4 send"    }Test/unicast11 instproc run {} {    $self next}Test/unicast11_sync instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast11_sync    set opt(nn) 3    $self next    $node_(0) set X_ 100.0    $node_(0) set Y_ 100.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 200.0    $node_(1) set Y_ 200.0    $node_(1) set Z_ 0.0        $node_(2) set X_ 300.0    $node_(2) set Y_ 100.0    $node_(2) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping3    # connect two agents    $ns_ connect $ping2 $ping3    set ping4 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping4    set ping5 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping5    # connect two agents    $ns_ connect $ping4 $ping5        # start times for connections    $ns_ at 40.1 "$ping0 send"    $ns_ at 40.1 "$ping2 send"    $ns_ at 40.1 "$ping4 send"    }Test/unicast11_sync instproc run {} {    $self next}Test/unicast12 instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast12    set opt(nn) 3    set opt(err)            UniformErrorProc    set opt(FECstrength)    1    ErrorModel set rate_ 0.1    ErrorModel set bandwidth_ 1Kb        $self next    $node_(0) set X_ 100.0    $node_(0) set Y_ 100.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 200.0    $node_(1) set Y_ 200.0    $node_(1) set Z_ 0.0        $node_(2) set X_ 300.0    $node_(2) set Y_ 100.0    $node_(2) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping3    # connect two agents    $ns_ connect $ping2 $ping3    set ping4 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping4    set ping5 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping5    # connect two agents    $ns_ connect $ping4 $ping5        # start times for connections    $ns_ at 0.1 "$ping0 send"    $ns_ at 0.1 "$ping2 send"    $ns_ at 0.1 "$ping4 send"    }Test/unicast12 instproc run {} {    $self next}Test/unicast12_sync instproc init {} {    global opt node_    $self instvar ns_ net_ testname_ topo_ tracefd_        set testname_ unicast12_sync    set opt(nn) 3    set opt(err)            UniformErrorProc    set opt(FECstrength)    1    ErrorModel set rate_ 0.1    ErrorModel set bandwidth_ 1Kb        $self next    $node_(0) set X_ 100.0    $node_(0) set Y_ 100.0    $node_(0) set Z_ 0.0        $node_(1) set X_ 200.0    $node_(1) set Y_ 200.0    $node_(1) set Z_ 0.0        $node_(2) set X_ 300.0    $node_(2) set Y_ 100.0    $node_(2) set Z_ 0.0    set ping0 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping0    set ping1 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping1    # connect two agents    $ns_ connect $ping0 $ping1            set ping2 [new Agent/Ping]    $ns_ attach-agent $node_(1) $ping2    set ping3 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping3    # connect two agents    $ns_ connect $ping2 $ping3    set ping4 [new Agent/Ping]    $ns_ attach-agent $node_(2) $ping4    set ping5 [new Agent/Ping]    $ns_ attach-agent $node_(0) $ping5    # connect two agents    $ns_ connect $ping4 $ping5        # start times for connections    $ns_ at 40.1 "$ping0 send"    $ns_ at 40.1 "$ping2 send"    $ns_ at 40.1 "$ping4 send"    }Test/unicast12_sync instproc run {} {    $self next}#Define a 'recv' function for the class 'Agent/Ping'Agent/Ping instproc recv {from rtt} {    $self instvar node_    puts "node [$node_ id] received ping answer from \              $from with round-trip-time $rtt ms."}TestSuite instproc finish {} {    $self instvar ns_ tracefd_    $ns_ flush-trace     close $tracefd_}proc runtest {arg} {    global quiet    set quiet 0        set b [llength $arg]    if {$b == 1} {	set test $arg    } elseif {$b == 2} {	set test [lindex $arg 0]	if {[lindex $arg 1] == "QUIET"} {	    set quiet 1	}    } else {	usage    }    set t [new Test/$test]    $t run}global argv arg0default_optionsruntest $argv

⌨️ 快捷键说明

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