问题
I need to arrange 100 nodes in a hexagonal shape in my tcl script. My simulation is wireless (dsr protocol). How can I do this? Which is the best size of the grid? I thought 3000x3000.
Thank you.
回答1:
The simplest way is to build the network graphically .. you can use nsg tool to build the network and generate the tcl code very easily
http://www.nsnam.com/2013/04/ns2-scenario-generator.html
first you must determine the transition range of nodes, put required number of node-> get network size , or you can compute it mathematically using transmition range and hexagon aria
https://en.wikipedia.org/wiki/Hexagon
If you plan to use nsg to draw a regular hexagon use this simple trick:
- if the transmition range is equal to 300 m then make it 250 m
- put first node in the center of the network.
- put two nodes in the border of first node coverage aria.
- put other nodes in the 4 Intersection of coverage area o previous 3 nodes.
- repeat previous steps for other hexagons.
- return the transmition range to its correct value (300 m).
来源:https://stackoverflow.com/questions/47359275/arrange-nodes-in-ns2