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

📄 test-suite-wireless-diffusion.tcl

📁 NS-2.28的802.11e协议扩展源代码
💻 TCL
📖 第 1 页 / 共 2 页
字号:
# Define node initial position in namfor {set i 0} {$i < $opt(nn)} {incr i} {    # 20 defines the node size in nam, must adjust it according to your scenario    # The function must be called after mobility model is defined    $ns_ initial_node_pos $node_($i) 20}$ns_ run}Test/diff-prob instproc init {} {   global opt   $self instvar ns_ topo god_    set opt(god)            on    set opt(traf)	"sk-30-1-1-1-1-6-64.tcl"      ;# traffic file    set opt(topo)	"scen-800x800-30-500-1.0-1"   ;# topology file    set opt(onoff)          ""                        ;# node on-off    set opt(adhocRouting)   DIFFUSION/PROB           set opt(enablePos)      "true"    set opt(enableNeg)      "true"    set opt(duplicate)      "enable-duplicate"   $self next}Test/diff-prob instproc run {} {   global opt   $self instvar ns_ topo god_    $god_ $opt(god)    $god_ allow_to_stop    $god_ num_data_types 1        $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 \		 -agentTrace ON \                 -routerTrace ON \                 -macTrace ON \		 -energyModel $opt(engmodel) \		 -initialEnergy $opt(initeng) \		 -txPower  $opt(txPower) \		 -rxPower  $opt(rxPower) \		 -idlePower  $opt(idlePower)			     for {set i 0} {$i < $opt(nn) } {incr i} {	set node_($i) [$ns_ node $i]	$node_($i) random-motion 0		;# disable random motion        $god_ new_node $node_($i)    }    if { $opt(topo) == "" } {	puts "*** NOTE: no topology file specified."        set opt(topo) "none"    } else {	puts "Loading topology file..."	source $opt(topo)	puts "Load complete..."    }    if { $opt(onoff) == "" } {	puts "*** NOTE: no node-on-off file specified."        set opt(onoff) "none"    } else {	puts "Loading node on-off file..."	source $opt(onoff)	puts "Load complete..."    }    if { $opt(traf) == "" } {	puts "*** NOTE: no traffic file specified."        set opt(traf) "none"    } else {	puts "Loading traffic file..."	source $opt(traf)	puts "Load complete..."    }## Tell all the nodes when the simulation ends#$ns_ at $opt(prestop) "$ns_ prepare-to-stop"for {set i 0} {$i < $opt(nn) } {incr i} {    $ns_ at $opt(stop).000000001 "$node_($i) reset";}$ns_ at $opt(stop).00000001 "$self finish; puts \"NS EXITING...\" ; $ns_ halt"# Define node initial position in namfor {set i 0} {$i < $opt(nn)} {incr i} {    # 20 defines the node size in nam, must adjust it according to your scenario    # The function must be called after mobility model is defined    $ns_ initial_node_pos $node_($i) 20}$ns_ run}Test/omnimcast instproc init {} {   global opt   $self instvar ns_ topo god_    set opt(god)            on    set opt(traf)	"sk-30-3-3-1-1-6-64.tcl"      ;# traffic file    set opt(topo)	"scen-800x800-30-500-1.0-1"   ;# topology file    set opt(onoff)          ""                        ;# node on-off    set opt(adhocRouting)   OMNIMCAST           set opt(duplicate)      "enable-duplicate"   $self next}Test/omnimcast instproc run {} {   global opt   $self instvar ns_ topo god_    $god_ $opt(god)    $god_ allow_to_stop    $god_ num_data_types 1        $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 \		 -agentTrace ON \                 -routerTrace ON \                 -macTrace ON \		 -energyModel $opt(engmodel) \		 -initialEnergy $opt(initeng) \		 -txPower  $opt(txPower) \		 -rxPower  $opt(rxPower) \		 -idlePower  $opt(idlePower)			     for {set i 0} {$i < $opt(nn) } {incr i} {	set node_($i) [$ns_ node $i]	$node_($i) random-motion 0		;# disable random motion        $god_ new_node $node_($i)    }    if { $opt(topo) == "" } {	puts "*** NOTE: no topology file specified."        set opt(topo) "none"    } else {	puts "Loading topology file..."	source $opt(topo)	puts "Load complete..."    }    if { $opt(onoff) == "" } {	puts "*** NOTE: no node-on-off file specified."        set opt(onoff) "none"    } else {	puts "Loading node on-off file..."	source $opt(onoff)	puts "Load complete..."    }    if { $opt(traf) == "" } {	puts "*** NOTE: no traffic file specified."        set opt(traf) "none"    } else {	puts "Loading traffic file..."	source $opt(traf)	puts "Load complete..."    }## Tell all the nodes when the simulation ends#$ns_ at $opt(prestop) "$ns_ prepare-to-stop"for {set i 0} {$i < $opt(nn) } {incr i} {    $ns_ at $opt(stop).000000001 "$node_($i) reset";}$ns_ at $opt(stop).00000001 "$self finish; puts \"NS EXITING...\" ; $ns_ halt"# Define node initial position in namfor {set i 0} {$i < $opt(nn)} {incr i} {    # 20 defines the node size in nam, must adjust it according to your scenario    # The function must be called after mobility model is defined    $ns_ initial_node_pos $node_($i) 20}$ns_ run}Test/flooding instproc init {} {   global opt   $self instvar ns_ topo god_    set opt(god)            on    set opt(traf)	"sk-30-3-3-1-1-6-64.tcl"      ;# traffic file    set opt(topo)	"scen-800x800-30-500-1.0-1"   ;# topology file    set opt(onoff)          ""                        ;# node on-off    set opt(adhocRouting)   FLOODING           set opt(duplicate)      "enable-duplicate"   $self next}Test/flooding instproc run {} {   global opt   $self instvar ns_ topo god_    $god_ $opt(god)    $god_ allow_to_stop    $god_ num_data_types 1        $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 \		 -agentTrace ON \                 -routerTrace ON \                 -macTrace ON \		 -energyModel $opt(engmodel) \		 -initialEnergy $opt(initeng) \		 -txPower  $opt(txPower) \		 -rxPower  $opt(rxPower) \		 -idlePower  $opt(idlePower)			     for {set i 0} {$i < $opt(nn) } {incr i} {	set node_($i) [$ns_ node $i]	$node_($i) random-motion 0		;# disable random motion        $god_ new_node $node_($i)    }    if { $opt(topo) == "" } {	puts "*** NOTE: no topology file specified."        set opt(topo) "none"    } else {	puts "Loading topology file..."	source $opt(topo)	puts "Load complete..."    }    if { $opt(onoff) == "" } {	puts "*** NOTE: no node-on-off file specified."        set opt(onoff) "none"    } else {	puts "Loading node on-off file..."	source $opt(onoff)	puts "Load complete..."    }    if { $opt(traf) == "" } {	puts "*** NOTE: no traffic file specified."        set opt(traf) "none"    } else {	puts "Loading traffic file..."	source $opt(traf)	puts "Load complete..."    }## Tell all the nodes when the simulation ends#$ns_ at $opt(prestop) "$ns_ prepare-to-stop"for {set i 0} {$i < $opt(nn) } {incr i} {    $ns_ at $opt(stop).000000001 "$node_($i) reset";}$ns_ at $opt(stop).00000001 "$self finish ; puts \"NS EXITING...\" ; $ns_ halt"# Define node initial position in namfor {set i 0} {$i < $opt(nn)} {incr i} {    # 20 defines the node size in nam, must adjust it according to your scenario    # The function must be called after mobility model is defined    $ns_ initial_node_pos $node_($i) 20}$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        }	switch $test {	        diff-rate-default -	        diff-rate-other -	        diff-prob -	        omnimcast -		flooding {                     set t [new Test/$test]                }                default {	             stderr "Unknown test $test"		     exit 1                }         }	 $t run}global argv arg0 runtest $argv

⌨️ 快捷键说明

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