In this report, I just show the simulation scripts to compare theperformance of DSDV, AODV, and DSR. More information about these adhoc routing protocols can be found on the Internet orbooks.
这段代码直接拷贝会出现如下问题:
num_nodes is set 50
invalid command name "-llType"
while executing
"-llType $val(ll) /"
(file "adhoc.tcl" line 48)
貌似是空格用了tab键什么的,所以代码直接到http://140.116.72.80/~smallko/ns2/adhoc_routing.htm
上面去复制比较保险。
(TCL script --- adhoc.tcl)
Performance metric: Packet Delivery fraction (The ratio of the data packets delivered to the destinations to those generated by the sources)
(AWK paring program --- getRatio.awk )
Before running simulation, we have to use the tools to generate the traffic and scenario patterns.
1. Traffic pattern (change the path to ~ns/indep-utils/cmu-scen-gen )
In this example, traffic models were generated for 50 nodes with CBR traffic sources, with maximum connections of 10 at a rate of 8kbps.
(-rate 2.0: in one second, 2 packets are generated. The packet size is 512 byte. Therefore the rate is 2*512*8=8kbps)
2. Scenario pattern (change the path to ~ns/indep-utils/cmu-scen-gen )
In this example, mobility models are created for the simulations using 50 nodes, with pause time of 0 seconds, maximum speed of 20m/s, topology boundary of 500x500 and simulation time of 100 secs .
After creating the traffic and scenario pattern files, copy them to the place where you put the adhoc.tcl .
Start Running Simulation
1. DSDV
Parse the result
1. AODV
2. DSR
The explanation for the results can be found at reference 1.
Reference
1. http://www.cs.utk.edu/~gupta/Adhoc.doc
2. http://www.ptpress.com.cn/books/Book_Information.asp?BID=11867
来源:http://140.116.72.80/~smallko/ns2/adhoc_routing.htm