This tutorial does not intend to discuss in details about the ONE, but attempts to guide you to simulate a simple network scenario using. The scope of this tutorial could be extended in future to include not-so-simple, and complex scenarios as I explore this software more.
- Specify the general settings for the scenario to be simulated
- Specify the network interface(s) of the nodes
- Create a group of nodes
- Specify the motion patterns
- Specify the traffic pattern
- Specify a set of reports to be generated
NS-2, configuration files would serve similar purpose that TCL scripts would do there. For example, in this(these) file(s) we would specify the number of nodes that our simulation would consist of, dimensions of the bounding region, how long the simulation would run, and so on.
ONE comes with a default_settings.txt file. It is important to note here that this file is read (used) for every simulation. Thus, we would, in general, be modifying this file to suit our purpose. However, when one goes for simulating a very complex scenario, it is better to take a modular approach. In that case we can have multiple configuration files. To reflect on this consider a few group of nodes with each group using different routing algorithms. To make life simple, we can store parameters for each such algorithms in different files. We just need to specify names of these files while running the simulation, as shown below:
./one.sh epidemic.txtNote that we never need to mention about default_settings.txt -- it is read automatically!
Note: In this tutorial all the configuration would be written in the default_settings.txt file. The contents of the entire file would be shown at the end.
## Scenario settings # A name to identify the present scenario Scenario.name = Test-5-nodes # Whether to create connections among nodes Scenario.simulateConnections = true # How frequently to sample the simulation Scenario.updateInterval = 1.0 # 43200s == 12h # How long the simulation will run (in seconds) Scenario.endTime = 5000 # How many groups of nodes to be created (atleast one) Scenario.nrofHostGroups = 1We can create multiple groups of nodes, with each group possibly having it’s own characteristics. Even if such a scenario is not required, we would create a single logical group and put all the nodes under it.
# "Bluetooth" interface for all nodes btInterface.type = SimpleBroadcastInterface # Transmit speed of 2 Mbps = 250kBps btInterface.transmitSpeed = 250k # Range of transmission (in meter) btInterface.transmitRange = 10
NOTE: ONE does not implement link or physical layer features.
# Common settings for all groups # Mobility model for all the nodes Group.movementModel = RandomWaypoint # Routing protocol to be used by a node in the group Group.router = EpidemicRouter # Buffer size of any node Group.bufferSize = 5M # All nodes have the bluetooth interface Group.nrofInterfaces = 1 Group.interface1 = btInterface # Walking speeds Group.speed = 0.5, 1.5 # Message TTL of 300 minutes (5 hours) Group.msgTtl = 300 # No. of nodes present in this group Group.nrofHosts = 5 # Identifier for the nodes in this group Group.groupID = nThus, we ask ONE to create five nodes with each of them moving randomly, and communicating with each other using Bluetooth.
## Movement model settings # seed for movement models' pseudo random number generator (default = 0) MovementModel.rngSeed = 1 # World's size for Movement Models without implicit size (width, height; in meters) MovementModel.worldSize = 450, 340
- Let ONE itself generate messages
- Load an external file containing a list of messages to be created (with timestamp, source node #, destination node #)
## Message creation parameters # How many event generators Events.nrof = 1 # Class of the first event generator Events1.class = MessageEventGenerator # (Following settings are specific for the MessageEventGenerator class) # Creation interval in seconds (one new message every 25 to 35 seconds) Events1.interval = 25,35 # Message sizes (500kB - 1MB) Events1.size = 500k,1M # Range of message source/destination addresses # Note: This shouldn’t be greater than # of nodes Events1.hosts = 0,4 # Message ID prefix Events1.prefix = M
## Reports - all report names have to be valid report classes # How many reports to load Report.nrofReports = 1 # Directory where reports would be created Report.reportDir = reports/Test-5-nodes # Report classes to load Report.report1 = MessageStatsReportThus, we are all set to run our first simple simulation of five randomly moving nodes. The contents of the entire default_settings file is given below.
# # Default settings for the simulation # ## Scenario settings Scenario.name = Test-5-nodes Scenario.simulateConnections = true Scenario.updateInterval = 1.0 # 43200s == 12h Scenario.endTime = 5000 Scenario.nrofHostGroups = 1 ## Interface-specific settings: # type : which interface class the interface belongs to # For different types, the sub-parameters are interface-specific # For SimpleBroadcastInterface, the parameters are: # transmitSpeed : transmit speed of the interface (bytes per second) # transmitRange : range of the interface (meters) # "Bluetooth" interface for all nodes btInterface.type = SimpleBroadcastInterface # Transmit speed of 2 Mbps = 250kBps btInterface.transmitSpeed = 250k btInterface.transmitRange = 10 ## Group-specific settings: # groupID : Group's identifier. Used as the prefix of host names # nrofHosts: number of hosts in the group # movementModel: movement model of the hosts (valid class name from movement package) # waitTime: minimum and maximum wait times (seconds) after reaching destination # speed: minimum and maximum speeds (m/s) when moving on a path # bufferSize: size of the message buffer (bytes) # router: router used to route messages (valid class name from routing package) # activeTimes: Time intervals when the nodes in the group are active (start1, end1, start2, end2, ...) # msgTtl : TTL (minutes) of the messages created by this host group, default=infinite ## Group and movement model specific settings # pois: Points Of Interest indexes and probabilities (poiIndex1, poiProb1, poiIndex2, poiProb2, ... ) # for ShortestPathMapBasedMovement # okMaps : which map nodes are OK for the group (map file indexes), default=all # for all MapBasedMovent models # routeFile: route's file path - for MapRouteMovement # routeType: route's type - for MapRouteMovement # Common settings for all groups Group.movementModel = RandomWaypoint Group.router = EpidemicRouter Group.bufferSize = 5M # All nodes have the bluetooth interface Group.nrofInterfaces = 1 Group.interface1 = btInterface # Walking speeds Group.speed = 0.5, 1.5 # Message TTL of 300 minutes (5 hours) Group.msgTtl = 300 Group.nrofHosts = 5 Group.groupID = n ## Movement model settings # seed for movement models' pseudo random number generator (default = 0) MovementModel.rngSeed = 1 # World's size for Movement Models without implicit size (width, height; meters) MovementModel.worldSize = 450, 340 # How long time to move hosts in the world before real simulation ## Message creation parameters # How many event generators Events.nrof = 1 # Class of the first event generator Events1.class = MessageEventGenerator # (following settings are specific for the MessageEventGenerator class) # Creation interval in seconds (one new message every 25 to 35 seconds) Events1.interval = 25,35 # Message sizes (500kB - 1MB) Events1.size = 500k,1M # range of message source/destination addresses Events1.hosts = 0,4 # Message ID prefix Events1.prefix = M ## Reports - all report names have to be valid report classes # how many reports to load Report.nrofReports = 1 Report.reportDir = reports/Test-5-nodes # Report classes to load Report.report1 = MessageStatsReport ## Optimization settings -- these affect the speed of the simulation ## see World class for details. Optimization.cellSizeMult = 5 Optimization.randomizeUpdateOrder = true
bash ./one.sh -bThe above will run the ONE in batch mode for a single time. If it doesn’t throw any error, a report files can be found in the reports/Test-5-nodes directory. The report file obtained by running this simulation is attached at the end of the page.
Alternatively, we can simply execute one.bat without the -b argument. That will open the visualizer of ONE, where we can view motion of nodes’, data exchange, and other different related events. A screenshot of ONE's GUI, showing five nodes, can be seen in figure-01. The nodes are prefixed with 'n' since we had earlier specified.
Group.groupID = nFigure-01: Visualization of network simulation with ONE
If you feel that this tutorial is useful and you would like to cite it in your research article, you can do it as:
B. K. Saha (2011, Jul.) The ONE Tutorial. Accessed: DD Mon. YYYY. [Online]. Available: http://delay-tolerant-networks.blogspot.com/p/one-tutorial.html
Next: Parametrized Simulations
Date of original draft: 04 July 2011
Last updated: 22 July 2011
Last updated: 18 June 2012 [Note about network interfaces; changed figure caption]
06 January 2013: Added the link to the ONE tutorial page
07 August 2013: Organizing; fixed ToC hyperlinks
11 March 2014: Added citation text
26 November 2014: Minor update to the text