📄 test-suite-smac.tcl
字号:
$node_(2) set X_ 470.0 $node_(2) set Y_ 470.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 set ping2 [new Agent/Ping] $ns_ attach-agent $node_(2) $ping2 # connect two agents $ns_ connect $ping0 $ping1 # start times for connections $ns_ at 0.1 "$ping0 send" $ns_ at 0.2 "$ping2 start-WL-brdcast" }Test/unicast3 instproc run {} { $self instvar ns_ $self next}Test/unicast3_sync instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast3_sync set opt(nn) 3 $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) set X_ 470.0 $node_(2) set Y_ 470.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 set ping2 [new Agent/Ping] $ns_ attach-agent $node_(2) $ping2 # connect two agents $ns_ connect $ping0 $ping1 # start times for connections $ns_ at 40.1 "$ping0 send" $ns_ at 45.2 "$ping2 start-WL-brdcast" }Test/unicast3_sync instproc run {} { $self instvar ns_ $self next}Test/unicast4 instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast4 set opt(nn) 3 $self next # can hear recvr, CTS only. $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) set X_ 470.0 $node_(2) set Y_ 470.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 set ping2 [new Agent/Ping] $ns_ attach-agent $node_(2) $ping2 # connect two agents $ns_ connect $ping0 $ping1 # start times for connections $ns_ at 0.1 "$ping0 send" $ns_ at 0.2 "$ping2 start-WL-brdcast" }Test/unicast4 instproc run {} { $self instvar ns_ $self next}Test/unicast4_sync instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast4_sync set opt(nn) 3 $self next # can hear recvr, CTS only. $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) set X_ 470.0 $node_(2) set Y_ 470.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 set ping2 [new Agent/Ping] $ns_ attach-agent $node_(2) $ping2 # connect two agents $ns_ connect $ping0 $ping1 # start times for connections $ns_ at 40.1 "$ping0 send" $ns_ at 40.2 "$ping2 start-WL-brdcast" }Test/unicast4_sync instproc run {} { $self instvar ns_ $self next}Test/unicast5 instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast5 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 can hear 0 & 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 0.1 "$ping0 send" #sender cannot hear other tx $ns_ at 0.1 "$ping3 send" }Test/unicast5 instproc run {} { $self instvar ns_ $self next}Test/unicast5_sync instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast5_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 can hear 0 & 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 "$ping0 send" #sender cannot hear other tx $ns_ at 40.1 "$ping3 send" }Test/unicast5_sync instproc run {} { $self instvar ns_ $self next}Test/unicast6 instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast6 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 0.1 "$ping0 send" #sender cannot hear other tx $ns_ at 0.1 "$ping3 send" }Test/unicast6 instproc run {} { $self instvar ns_ $self next}Test/unicast6_sync instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast6_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 "$ping0 send" #sender cannot hear other tx # node 2 and 3 have perfectly sync'ed cycles # due to collision discovers each other after about 60s. $ns_ at 60.1 "$ping3 send" }Test/unicast6_sync instproc run {} { $self next}Test/unicast7 instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast7 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 0.1 "$ping0 send" #sender cannot hear other tx $ns_ at 0.1 "$ping2 send" }Test/unicast7 instproc run {} { $self next}Test/unicast7_sync instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast7_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 "$ping0 send" #sender cannot hear other tx $ns_ at 60.1 "$ping2 send" }Test/unicast7_sync instproc run {} { $self next}Test/unicast8 instproc init {} { global opt node_ $self instvar ns_ net_ testname_ topo_ tracefd_ set testname_ unicast8 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 0.1 "$ping1 send" #sender cannot hear other tx $ns_ at 0.1 "$ping2 send" }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -