📄 test-suite-diffusion3.tcl
字号:
# 1 ping receiver set snk_(0) [new Application/DiffApp/PingReceiver/OPP] $ns_ attach-diffapp $node_(9) $snk_(0) $ns_ at 1.456 "$snk_(0) subscribe" # # Tell nodes when the simulation ends # for {set i 0} {$i < $opt(nn) } {incr i} { $ns_ at $opt(stop).000000001 "$node_($i) reset"; } $ns_ at $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt" $ns_ run}Class Test/1pp-10n-1s-4r -superclass TestSuiteTest/1pp-10n-1s-4r instproc init {} { global opt set opt(nn) 10 set opt(sndr) 1 set opt(rcvr) 4 set opt(filters) OnePhasePullFilter $self instvar ns_ testName_ set testName_ 1pp-10n-1s-4r $self next}Test/1pp-10n-1s-4r instproc run {} { global opt $self instvar ns_ topo god_ set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) set god_ [create-god $opt(nn)] $ns_ node-config -adhocRouting $opt(adhocRouting) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType $opt(ant) \ -propType $opt(prop) \ -phyType $opt(netif) \ -channelType $opt(chan) \ -topoInstance $topo \ -diffusionFilter $opt(filters) \ -agentTrace ON \ -routerTrace OFF \ -macTrace OFF for {set i 0} {$i < $opt(nn) } {incr i} { set node_($i) [$ns_ node $i] $node_($i) color black $node_($i) random-motion 0 ;# disable random motion $god_ new_node $node_($i) } # defining node positions $node_(0) set X_ 18.587605569735 $node_(0) set Y_ 401.886827012678 $node_(0) set Z_ 0.000000000000 $node_(1) set X_ 11.901958617639 $node_(1) set Y_ 36.218497218617 $node_(1) set Z_ 0.000000000000 $node_(2) set X_ 224.282785411393 $node_(2) set Y_ 20.774608253697 $node_(2) set Z_ 0.000000000000 $node_(3) set X_ 158.840938304009 $node_(3) set Y_ 139.650216383776 $node_(3) set Z_ 0.000000000000 $node_(4) set X_ 101.186886005903 $node_(4) set Y_ 147.993190973633 $node_(4) set Z_ 0.000000000000 $node_(5) set X_ 321.560825121175 $node_(5) set Y_ 472.788096833600 $node_(5) set Z_ 0.000000000000 $node_(6) set X_ 149.543901734330 $node_(6) set Y_ 384.356581531832 $node_(6) set Z_ 0.000000000000 $node_(7) set X_ 381.066146464027 $node_(7) set Y_ 78.723958958779 $node_(7) set Z_ 0.000000000000 $node_(8) set X_ 113.578290026963 $node_(8) set Y_ 410.320583900348 $node_(8) set Z_ 0.000000000000 $node_(9) set X_ 258.053977148981 $node_(9) set Y_ 113.194171851670 $node_(9) set Z_ 0.000000000000 # 1 ping sender for {set i 0} {$i < $opt(sndr)} {incr i} { set src_($i) [new Application/DiffApp/PingSender/OPP] $ns_ attach-diffapp $node_([expr $i+2]) $src_($i) $ns_ at [expr 0.123 * [expr 1+$i]] "$src_($i) publish" } # 4 ping receiver for {set i 0} {$i < $opt(rcvr)} {incr i} { set snk_($i) [new Application/DiffApp/PingReceiver/OPP] $ns_ attach-diffapp $node_([expr $opt(nn)-1 -$i]) $snk_($i) $ns_ at [expr 1.1*[expr 1+$i]] "$snk_($i) subscribe" } # # Tell nodes when the simulation ends # for {set i 0} {$i < $opt(nn) } {incr i} { $ns_ at $opt(stop).000000001 "$node_($i) reset"; } $ns_ at $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt" $ns_ run}Class Test/gear-2pp-5n-1s-1r -superclass TestSuiteTest/gear-2pp-5n-1s-1r instproc init {} { global opt set opt(nn) 5 set opt(filters) GradientFilter/GeoRoutingFilter $self instvar ns_ testName_ set testName_ gear-2pp-5n-1s-1r $self next}Test/gear-2pp-5n-1s-1r instproc run {} { global opt $self instvar ns_ topo god_ set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) set god_ [create-god $opt(nn)] $ns_ node-config -adhocRouting $opt(adhocRouting) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType $opt(ant) \ -propType $opt(prop) \ -phyType $opt(netif) \ -channelType $opt(chan) \ -topoInstance $topo \ -diffusionFilter $opt(filters) \ -agentTrace ON \ -routerTrace OFF \ -macTrace OFF for {set i 0} {$i < $opt(nn) } {incr i} { set node_($i) [$ns_ node $i] $node_($i) color black $node_($i) random-motion 0 ;# disable random motion $god_ new_node $node_($i) } # defining node positions $node_(0) set X_ 618.716707738489 $node_(0) set Y_ 620.707335765875 $node_(0) set Z_ 0.000000000000 $node_(1) set X_ 524.192740186325 $node_(1) set Y_ 540.384818286195 $node_(1) set Z_ 0.000000000000 $node_(2) set X_ 406.438972165239 $node_(2) set Y_ 425.843469852367 $node_(2) set Z_ 0.000000000000 $node_(3) set X_ 320.192740186325 $node_(3) set Y_ 350.384818286195 $node_(3) set Z_ 0.000000000000 $node_(4) set X_ 177.438972165239 $node_(4) set Y_ 145.843469852367 $node_(4) set Z_ 0.000000000000 for {set i 0} {$i < $opt(nn)} {incr i} { set gearf($i) [new Application/DiffApp/GeoRoutingFilter \ [$node_($i) get-dr]] $gearf($i) start } # 1 gear sender set src_(0) [new Application/DiffApp/GearSenderApp] $ns_ attach-diffapp $node_(0) $src_(0) $src_(0) push-pull-options pull point 618.716 620.707 $ns_ at 0.123 "$src_(0) publish" #Diffusion application - ping receiver set snk_(0) [new Application/DiffApp/GearReceiverApp] $ns_ attach-diffapp $node_(4) $snk_(0) $snk_(0) push-pull-options pull region 600 650 600 650 $ns_ at 1.456 "$snk_(0) subscribe" # # Tell nodes when the simulation ends # for {set i 0} {$i < $opt(nn) } {incr i} { $ns_ at $opt(stop).000000001 "$node_($i) reset"; } $ns_ at $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt" $ns_ run} Class Test/gear-2pp-10n-4s-1r -superclass TestSuiteTest/gear-2pp-10n-4s-1r instproc init {} { global opt set opt(nn) 10 set opt(filters) GradientFilter/GeoRoutingFilter $self instvar ns_ testName_ set testName_ gear-2pp-10n-4s-1r $self next }Test/gear-2pp-10n-4s-1r instproc run {} { global opt $self instvar ns_ topo god_ set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) set god_ [create-god $opt(nn)] $ns_ node-config -adhocRouting $opt(adhocRouting) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType $opt(ant) \ -propType $opt(prop) \ -phyType $opt(netif) \ -channelType $opt(chan) \ -topoInstance $topo \ -diffusionFilter $opt(filters) \ -agentTrace ON \ -routerTrace OFF \ -macTrace OFF for {set i 0} {$i < $opt(nn) } {incr i} { set node_($i) [$ns_ node $i] $node_($i) color black $node_($i) random-motion 0 ;# disable random motion $god_ new_node $node_($i) } # defining node positions $node_(0) set X_ 180.587605569735 $node_(0) set Y_ 401.886827012678 $node_(0) set Z_ 0.000000000000 $node_(1) set X_ 11.901958617639 $node_(1) set Y_ 36.218497218617 $node_(1) set Z_ 0.000000000000 $node_(2) set X_ 224.282785411393 $node_(2) set Y_ 20.774608253697 $node_(2) set Z_ 0.000000000000 $node_(3) set X_ 158.840938304009 $node_(3) set Y_ 139.650216383776 $node_(3) set Z_ 0.000000000000 $node_(4) set X_ 101.186886005903 $node_(4) set Y_ 147.993190973633 $node_(4) set Z_ 0.000000000000 $node_(5) set X_ 321.560825121175 $node_(5) set Y_ 472.788096833600 $node_(5) set Z_ 0.000000000000 $node_(6) set X_ 149.543901734330 $node_(6) set Y_ 384.356581531832 $node_(6) set Z_ 0.000000000000 $node_(7) set X_ 381.066146464027 $node_(7) set Y_ 78.723958958779 $node_(7) set Z_ 0.000000000000 $node_(8) set X_ 113.578290026963 $node_(8) set Y_ 410.320583900348 $node_(8) set Z_ 0.000000000000 $node_(9) set X_ 258.053977148981 $node_(9) set Y_ 113.194171851670 $node_(9) set Z_ 0.000000000000 # starting gear filter separately- this will go away once gear has # callbacks for updating node positions for {set i 0} {$i < $opt(nn)} {incr i} { set gearf($i) [new Application/DiffApp/GeoRoutingFilter \ [$node_($i) get-dr]] $gearf($i) start } # 4 gear sender set src_(0) [new Application/DiffApp/GearSenderApp] $ns_ attach-diffapp $node_(0) $src_(0) $src_(0) push-pull-options pull point 180.587 401.886 $ns_ at 0.123 "$src_(0) publish" set src_(1) [new Application/DiffApp/GearSenderApp] $ns_ attach-diffapp $node_(1) $src_(1) $src_(1) push-pull-options pull point 11.901 36.218 $ns_ at 0.23 "$src_(1) publish" set src_(2) [new Application/DiffApp/GearSenderApp] $ns_ attach-diffapp $node_(2) $src_(2) $src_(2) push-pull-options pull point 224.282 20.774 $ns_ at 0.3 "$src_(2) publish" set src_(3) [new Application/DiffApp/GearSenderApp] $ns_ attach-diffapp $node_(3) $src_(3) $src_(3) push-pull-options pull point 158.840 139.650 $ns_ at 0.4 "$src_(3) publish" # 1 ping receiver set snk_(0) [new Application/DiffApp/GearReceiverApp] $ns_ attach-diffapp $node_(7) $snk_(0) $snk_(0) push-pull-options pull region 10 300 10 450 $ns_ at 1.456 "$snk_(0) subscribe" # # Tell nodes when the simulation ends # for {set i 0} {$i < $opt(nn) } {incr i} { $ns_ at $opt(stop).000000001 "$node_($i) reset"; } $ns_ at $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt" $ns_ run}Class Test/gear-push-10n-1s-4r -superclass TestSuiteTest/gear-push-10n-1s-4r instproc init {} { global opt set opt(nn) 10 set opt(filters) GradientFilter/GeoRoutingFilter $self instvar ns_ testName_ set testName_ gear-push-10n-1s-4r $self next}Test/gear-push-10n-1s-4r instproc run {} { global opt $self instvar ns_ topo god_ set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) set god_ [create-god $opt(nn)] $ns_ node-config -adhocRouting $opt(adhocRouting) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType $opt(ant) \ -propType $opt(prop) \ -phyType $opt(netif) \ -channelType $opt(chan) \ -topoInstance $topo \ -diffusionFilter $opt(filters) \ -agentTrace ON \ -routerTrace OFF \ -macTrace OFF for {set i 0} {$i < $opt(nn) } {incr i} { set node_($i) [$ns_ node $i] $node_($i) color black $node_($i) random-motion 0 ;# disable random motion $god_ new_node $node_($i) } # defining node positions $node_(0) set X_ 180.587605569735 $node_(0) set Y_ 401.886827012678 $node_(0) set Z_ 0.000000000000 $node_(1) set X_ 11.901958617639 $node_(1) set Y_ 36.218497218617 $node_(1) set Z_ 0.000000000000 $node_(2) set X_ 224.282785411393 $node_(2) set Y_ 20.774608253697 $node_(2) set Z_ 0.000000000000 $node_(3) set X_ 158.840938304009 $node_(3) set Y_ 139.650216383776 $node_(3) set Z_ 0.000000000000 $node_(4) set X_ 101.186886005903 $node_(4) set Y_ 147.993190973633 $node_(4) set Z_ 0.000000000000 $node_(5) set X_ 321.560825121175 $node_(5) set Y_ 472.788096833600 $node_(5) set Z_ 0.000000000000 $node_(6) set X_ 149.543901734330 $node_(6) set Y_ 384.356581531832 $node_(6) set Z_ 0.000000000000 $node_(7) set X_ 381.066146464027 $node_(7) set Y_ 78.723958958779 $node_(7) set Z_ 0.000000000000 $node_(8) set X_ 113.578290026963 $node_(8) set Y_ 410.320583900348 $node_(8) set Z_ 0.000000000000 $node_(9) set X_ 258.053977148981 $node_(9) set Y_ 113.194171851670 $node_(9) set Z_ 0.000000000000 # starting gear filter separately- this will go away once gear has # callbacks for updating node positions for {set i 0} {$i < $opt(nn)} {incr i} { set gearf($i) [new Application/DiffApp/GeoRoutingFilter \ [$node_($i) get-dr]] $gearf($i) start } # 1 push sender set src_(0) [new Application/DiffApp/GearSenderApp] $ns_ attach-diffapp $node_(6) $src_(0) $src_(0) push-pull-options push region 100 650 100 650 $ns_ at 0.123 "$src_(0) publish" # 4 push receiver set snk_(0) [new Application/DiffApp/GearReceiverApp] $ns_ attach-diffapp $node_(8) $snk_(0) $snk_(0) push-pull-options push point 101.186 147.993 $ns_ at 1.256 "$snk_(0) subscribe" set snk_(1) [new Application/DiffApp/GearReceiverApp] $ns_ attach-diffapp $node_(9) $snk_(1) $snk_(1) push-pull-options push point 258.053 113.194 $ns_ at 1.456 "$snk_(1) subscribe" set snk_(2) [new Application/DiffApp/GearReceiverApp] $ns_ attach-diffapp $node_(7) $snk_(2) $snk_(2) push-pull-options push point 321.560 472.788 $ns_ at 1.56 "$snk_(2) subscribe" set snk_(3) [new Application/DiffApp/GearReceiverApp] $ns_ attach-diffapp $node_(1) $snk_(3) $snk_(3) push-pull-options push point 158.840 139.650 $ns_ at 1.73 "$snk_(3) subscribe" # # Tell nodes when the simulation ends # for {set i 0} {$i < $opt(nn) } {incr i} { $ns_ at $opt(stop).000000001 "$node_($i) reset"; } $ns_ at $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt" $ns_ run}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 arg0 runtest $argv
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -