Today, Dr. ke zhiheng's experiment 23 compared different wireless network routes, DSDV/Oscar/DSR. I wrote scripts and awk programs according to the requirements in the book, and the test went smoothly. However, in Experiment 2, a message indicating that the UID of the event is invalid occurs during the DSR experiment. Check the trace file and find that it is at the position of about 56 s. I checked a lot of information and found no solution. And do not dare to modify Mac files. But after reading some explanations, I suspect it may be a setup in the Tcl Script: MAC/802_11 set slottime _ 0.000020; # 20us is not suitable. The slot length is set to 20 us. I tried to change this parameter. Change 20us to 10us. Run it again and pass it smoothly!
Although I have passed the test, I still cannot understand the reason. Now I have pasted the Tcl script together. I hope you can give me some advice.
Proc getopt {argc argv }{
Global OPT
Lappend optlist NN
For {set I 0} {$ I <$ argc} {incr I }{
Set OPT ($ I) [lindex $ argv $ I]
}
}
Getopt $ argc $ argv
# Parameter settings
Set OPT (Chan) channel/wirelesschannel
Set OPT (PROP) Propagation/tworayground
Set OPT (netif) PHY/wirelessphy
# The following settings are special. If DSR is used, cmupriqueue is used for ifq.
Set OPT (MAC) MAC/802_11
If {$ OPT (0) = "DSR "}{
Set OPT (ifq) cmupriqueue
} Else {
Set OPT (ifq) queue/droptail/priqueue; # interface queue type
}
Set OPT (LL) LL
Set OPT (ANT) antenna/omniantenna
Set OPT (x) 500
Sets OPT (y) 500
Set OPT (ifqlen) 2000
Set OPT (SEED) 0.0
Set OPT (TR) trace2.tr; # trace file
Set OPT (adhocrouting) $ OPT (0)
Set OPT (NN) 100
Set OPT (CP) "cbr_n100_m10_r10"
Set OPT (SC) "scen_100n_0p_10m_100t_500_500"
Set OPT (STOP) 100.0
MAC/802_11 set cwmin _ 31
MAC/802_11 set cwmax _ 1023
MAC/802_11 set slottime _ 0.000010; # 10us
MAC/802_11 set SiFs _ 0.000010; # 10us
MAC/802_11 set preamblelength _ 144; # 144bit
MAC/802_11 set preambledatarate _ 1.0e6; #1 Mbps
MAC/802_11 set plcpheaderlength _ 48; # 48bit
MAC/802_11 set plcpdatarate _ 1.0e6; #1 mpbs
MAC/802_11 set rtsthreshold _ 3000; # bytes disable RTS/CTS
MAC/802_11 set shortretrylimit _ 7; # retrans_mission _
MAC/802_11 set longretrylimit _ 4; # retrans_mission _
MAC/802_11 set datarate _ 2 MB; #802.11 data trans_mission Rate
MAC/802_11 set basicrate _ 1 MB; #802.11 basic trans_mission Rate
Set NS _ [New simulator]
Set tracefd [open $ OPT (TR) W]
$ NS _ trace-all $ tracefd
Set Topo [New topography]
$ Topo load_flatgrid $ OPT (x) $ OPT (y)
Set God _ [Create-God $ OPT (NN)]
Set chan_1 _ [new $ OPT (Chan)]
$ NS _ node-config-adhocrouting $ OPT (adhocrouting )\
-Lltype $ OPT (LL )\
-Mactype $ OPT (MAC )\
-Ifqtype $ OPT (ifq )\
-Anttype $ OPT (ANT )\
-Ifqlen $ OPT (ifqlen )\
-Proptype $ OPT (PROP )\
-Phytype $ OPT (netif )\
-Channel $ chan_1 _\
-Topoinstance $ Topo \
-Agenttrace on \
-Routertrace on \
-Mactrace off
For {set I 0} {$ I <$ OPT (NN)} {incr I }{
Set node _ ($ I) [$ NS _ node]
$ Node _ ($ I) random-motion 0
}
# Set the node movement mode
Puts "loading connection pattern ..."
# Use source to load the traffic pattern file
Source $ OPT (CP)
# Set the online transmission mode
Puts "loading scenario file ..."
# Use source to load node mobile scenario files
Source $ OPT (SC)
For {set I 0} {$ I <$ OPT (NN)} {incr I }{
$ NS _ initial_node_pos $ node _ ($ I) 20
}
For {set I 0} {$ I <$ OPT (NN)} {incr I }{
$ NS _ at $ OPT (STOP). 1 "$ node _ ($ I) reset"
}
$ NS _ at $ OPT (STOP). 1 "puts \" ns exiting... \ "; $ NS _ halt"
Puts "Starting simulation ..."
$ NS _ run