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

📄 test_3n_m.tcl

📁 DYMOUM is an implementation of the DYMO (Dynamic Manet On-demand) routing protocol both for Linux ke
💻 TCL
字号:
# ======================================================================# Define options# ======================================================================set opt(chan)           Channel/WirelessChannel  ;# channel typeset opt(prop)           Propagation/TwoRayGround ;# radio-propagation modelset opt(netif)          Phy/WirelessPhy          ;# network interface typeset opt(mac)            Mac/802_11               ;# MAC typeset opt(ifq)            Queue/DropTail/PriQueue  ;# interface queue typeset opt(ll)             LL                       ;# link layer typeset opt(ant)            Antenna/OmniAntenna      ;# antenna modelset opt(ifqlen)         50                       ;# max packet in ifqset opt(nn)             3                        ;# number of mobilenodesset opt(adhocRouting)   DYMOUM                   ;# routing protocolset opt(cp)             ""                        ;# connection pattern fileset opt(sc)             "test_sc-3-900-0-500-100" ;# node movement file. set opt(x)              500                      ;# x coordinate of topologyset opt(y)              100                      ;# y coordinate of topologyset opt(seed)           0.0                      ;# seed for random number gen.set opt(stop)           900                      ;# time to stop simulationset opt(cbr-start)      10.0# ============================================================================## check for random seed#if {$opt(seed) > 0} {    puts "Seeding Random number generator with $opt(seed)\n"    ns-random $opt(seed)}## create simulator instance#set ns_ [new Simulator]## control DYMOUM behaviour from this script#Agent/DYMOUM set debug_ trueAgent/DYMOUM set no_path_acc_ trueAgent/DYMOUM set reissue_rreq_ trueAgent/DYMOUM set s_bit_ falseAgent/DYMOUM set hello_ival_ 1## open traces#set tracefd  [open test_3n_m.tr w]set namtrace [open test_3n_m.nam w]$ns_ trace-all $tracefd$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)## create topography object#set topo [new Topography]## define topology#$topo load_flatgrid $opt(x) $opt(y)## create God#set god_ [create-god $opt(nn)]## configure mobile nodes#$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 \                 -wiredRouting OFF \                 -agentTrace ON \                 -routerTrace ON \                 -macTrace OFFfor {set i 0} {$i < $opt(nn)} {incr i} {    set node_($i) [$ns_ node]}## setup UDP connection#set udp [new Agent/UDP]set null [new Agent/Null]$ns_ attach-agent $node_(0) $udp$ns_ attach-agent $node_(2) $null$ns_ connect $udp $nullset cbr [new Application/Traffic/CBR]$cbr set packetSize_ 512$cbr set rate_ 20Kb$cbr attach-agent $udp$ns_ at $opt(cbr-start) "$cbr start"## print (in the trace file) routing table and other# internal data structures on a per-node basis# TODO: implement this#$ns_ at 15.0 "[$node_(0) agent 255] print_rtable"## source connection-pattern and node-movement scripts#if { $opt(cp) == "" } {    puts "*** NOTE: no connection pattern specified."    set opt(cp) "none"} else {    puts "Loading connection pattern..."    source $opt(cp)}if { $opt(sc) == "" } {    puts "*** NOTE: no scenario file specified."    set opt(sc) "none"} else {    puts "Loading scenario file..."    source $opt(sc)    puts "Load complete..."}## define initial node position in nam#for {set i 0} {$i < $opt(nn)} {incr i} {    $ns_ initial_node_pos $node_($i) 20}     ## tell all nodes when the simulation ends#for {set i 0} {$i < $opt(nn) } {incr i} {    $ns_ at $opt(stop).0 "$node_($i) reset";}$ns_ at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"$ns_ at $opt(stop).0001 "stop"proc stop {} {    global ns_ tracefd namtrace    $ns_ flush-trace    close $tracefd    close $namtrace}## begin simulation#puts "Starting Simulation..."$ns_ run

⌨️ 快捷键说明

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