Have you tried the ONE Knowledge Base yet?
Introduction
The Opportunistic Network Environment (ONE) is a Java based simulator targeted for research in Delay Tolerant Networks (DTNs) and its variants such as, Opportunistic Mobile Networks (OMNs). Apart from letting users simulate different scenarios quickly and in a flexible manner, the ONE also provides an easy way to generate statistics from the simulation(s) performed. The ONE simulator can be run on Linux, Windows, or any other platform supporting Java. Details about the ONE, including how to download and run, can be found at the official site. A list of common questions and their answers are listed here.Why?
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.
Target Audience
This tutorial is aimed for the beginners who quickly want to gain experience with the ONE simulator through a easy and simple example!Pre-conditions
This tutorial assumes that you have downloaded the ONE source code, and have executed the compile.bat file to generate all the related Java classes successfully.The Scenario
Simulate a network consisting of five nodes moving randomly inside a rectangular region with certain speed.General Steps
Below are the steps that we will be following to perform our simulation. In fact, these are some steps that every simulation would involve.- 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
Configuration File(s)
Configuration file(s) define various settings for our simulation. If you are familiar to 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!
Specify Scenario Settings
The first step of a simulation is to setup the scenario. For example, how long would the simulation run, how many groups of nodes would it consist of, a name for the current scenario, and so on. The listing below shows some of the specifications together with their explanations as comment lines.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.
Specify Network Interfaces for Nodes
We have to instruct the simulator about how the different nodes will communicate. For example, two computers can communicate over, say, Ethernet or P2P links. In our case, all the nodes would exchange messages using Bluetooth as shown below.# "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.
Create a Group of Nodes
As mentioned earlier, we can have multiple logical groups of nodes in ONE. For example, consider a rescue operation (after a disaster) performed by close coordination of army, health, fire brigade, and civil organizations. We can represent this situation with four groups, and define individual behaviour of a group. However, in this example, we will consider only a single group, as shown below.# 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.
Specify Motion Patterns
Individual groups can have their own mobility model. We have already specified in the previous section that all nodes would move randomly (RandomWaypoint model). However, we also need to specify the system boundary i.e. area of the (2D) space within which motion of nodes would remain confined to. We do that in the following way.## 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
Specify Traffic Pattern
A network simulation is not of any practical use unless nodes exchange messages. ONE allow us to do this in two possible ways:- 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
Specify Reports to be Generated
ONE makes our work of network analysis simplified by generating a set of reports. For example, from MessageStatsReport we can find out the number of messages created, delivered, dropped, average buffer time, and so on. We will generate only this report for our simulation, as shown below.## 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
Running the Simulation
Once our settings file is ready we can go ahead and run the simulation. The steps for doing this in Linux: Open a command prompt, change to the directory containing the ONE source code, and type: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
Dear Barun
ReplyDeleteI want to work with Bundle Protocol and its convergence layer (TCP).
Is there any TCP layer module in ONE?
If not, which simulator in DTN research best suitable to work with protocol layers?
-Somoy
Somoy,
ReplyDeleteAm myself very new to The ONE, and DTN in general. As such, I might not be able to answer your question. Please join The ONE mailing list, and post your queries there. Experts would be able to give you some insight.
https://www.netlab.tkk.fi/mailman/listinfo/theone
Hmm. I shall try there then. Thx.
ReplyDeletewhen i am running ONE in eclipse i have got this error:-
ReplyDeleteCan't start: error in configuration file(s)
Can't find setting 'Scenario.nrofHostGroups'
so what can i do now tell me ASAP.
I too faced the same problem but finally got the solution....
ReplyDeleteYou have to point to source file in arguments tab of run configuration by selecting other....
Ex: ${workspace_loc:One_DTN_Test/src}
I hope it will be helpful
Thanks,
Tejas
how to convert the exported map in www.openstreetmap.org site extension to osm wk thank you
Deletehow to convert the exported map in www.openstreetmap.org site extension to osm wk thank you
ReplyDeleteONE has a software called OSM2WKT. try it...
DeleteI would the link to download osm2wkt ? please
ReplyDeleteplease i want softward osmtowkt plzzzzzzzzzzzzzzzzzzzz some one can help me
ReplyDeleteHow To Change Map
ReplyDeleteHow and where to configure Hop counts in ONE running on Eclipse?
ReplyDeleteThanks,
Tejas
Hi Tejas,
DeleteCurrently, hop count is not a configurable parameter in the ONE simulator. If you want to have hop count-limited message forwarding, you should write a new router class incorporating the logic. That new class (say, HopCountLimitedRouter) should have a setting (say, maxHopCount) that can specified as simulation parameter.
Do you know how to get report in the form of (node id, total number of message received, total number of node in contact)? If need to define a new class, can you help me with that?
ReplyDeleteHi Alex,
DeleteInformation about message transfers can be obtained by implementing the MessageListener interface (e.g., look at MessageDeliveryReport). On the other hand, for tracking connection events, implement the ConnectionListener interface (e.g., look at TotalEncountersReport).
You can write a custom report that implements both the listeners. Have a list of counters of size N (= # of nodes), and increment appropriately on message delivery. Use another list of counters to track the connection up events.
Hope this helps.
To All Respected Researchers,
ReplyDeleteAnyone can help me regarding avoidance of some nodes during simulation using ONE simulator?
1) As we know the total simulation time is: 43200 s, how to divide the total time into some sub intervals?
2) Say, I want the 1st sub interval 2000s. After 2000s we want to avoid some nodes, how to avoid those nodes and in the 2nd sub interval how to continue simulation bypassing those nodes?
Please help me if possible.
Chandrima Chakrabarti
how to implement multicasting in ONE
ReplyDeletethe default scale reference in ONE is 100 metres...how to change the scale to any desired value??
ReplyDeleteplzz help
Sumit,
DeleteWhich scale are you talking about?
Thanks for this useful post.
ReplyDeleteFor example,
ReplyDeleteI am running one using test.txt,
bash ./one.sh test.txt
How I can run this for seeds 1 to 10?
Or in other words how parameters can be passed to a test.txt so that I can run ONE with different value by running this command once?
Thanks in advance,
Ranjana
Ranjana,
DeleteYou should specify all the seed values against the MovementModel.rngSeed parameter in your settings file. Based on combination of all the parameters used, you would get say, N, unique scenarios. You can execute them all at once using
bash ./one.sh test.txt -b N
do you know how to modify broadcast mechanism on epidemic routing?
ReplyDeleteDenar,
DeleteIf you want to decide whether or not to replicate a given message to a given node, you should look at the code of the PRoPHET routing protocol.
ok thanks,
Deletebarun,
how to change correct movementModel in default_setting.txt?
because i have changed movementModel with MapBasedMovement and than i get an error something like this :
"Can't start: error in configuration file(s)
Map node (3166.38,8090.61) is out of world bounds (x: 0...450 y: 0...340)"
do i have make map with size x: 0...450 and y : 0...340?
but if i change the movementModel with RandomWaypoint, there is no error
The dimension of the simulation world should be large enough to contain all the location coordinates generated during the simulation. This especially needs to be taken care of if you are using external mobility traces.
DeleteRWP may not necessarily throw this error depending on the simulation settings. It is quite possible that locations generated while using RWP were below (450, 340).
Regret my incorrect statement in the previous comment. RWP, and any other synthetic mobility model, will *always* generate coordinates within the bounds of your simulation world. Hope this clarifies.
DeleteGood Teaching!! By Blogger!!!Thanks Man!! It's Nice If you can give more tutorial on this!
ReplyDeleteHi! Thanks for this tutorial. I was wondering if you knew how to let the simulation go into batch mode in eclipse. Thanks!
ReplyDeleteBill,
DeleteThanks for your input! To run in batch mode you essentially need to provide "-b" as a command line argument. Check out step # 7 in this tutorial: http://theopentutorials.com/tutorials/java/cmd-line-args/how-to-pass-command-line-arguments-in-eclipse-ide/
nice and useful tutorial.
ReplyDeleteHi, amazing tutorial. Did you ever try changing the map? I really need help on changing the map. I can create WKT layers but when I turn on underlay image I find it mispositioned. How can I fix it?
ReplyDeleteHi! G8 tutorial...But I realised that ONE does not provide any form of encryption. Have you ever tried to encrypt messages in DTN. I really need some help in encrypting messages in DTN. Am really stuck at this stage.
ReplyDeleteThanks for your comment!
DeleteThe focus of the ONE simulator has been on the network layer of DTNs/OMNs. The simulator, however, allows you to attach one or more application(s) to a node. You might investigate that to find out if implementation of encryption facilities is feasible. And no, I have not worked with encryption.
this tutorial is really very helpful...
ReplyDeletethanks a lot sir.
@Barun
ReplyDeletePls how do i implement other routing protocol i:e Prophet Routing. i Follow this tutorial and it was really helpful.
thanks alot.
Salawudeen,
DeleteThanks for your comment!
Implementation of quite a few routing protocols are available in the routing module. Please look at their code and study them carefully. In particular, the code for Prophet is also available there.
Hi
DeletePlease if anyone can help me.. i am implementing a buffer scheduling police called Average Contact Frequency (ACF) where a node generate a table for each node that it frequently encounters it, and this table is updated periodically... can anyone help me in writing the code in ONE ???
Barun Saha, how can I reporting the time and the location that each messages were generated?
ReplyDeleteTailan,
ReplyDeleteUse MessageReport to obtain the message creation times. Extend the report to print the location of the nodes creating while the messages are created.
Dear Barun,
ReplyDeleteThank you very much for this interesting tutorial.
I would like to know if we can create fixed nodes together with mobile ones. I'm trying to simulate a scenario of collaborative mobile learning environment, where the mobile nodes represent the mobile learners and the fixed nodes represents the learning objects ( books, trees, etc).
Thank in advance for you answer.
Regards.
Karim,
DeleteOf course, you can! Create multiple groups of nodes (hosts) -- one for the mobile nodes, and others for the stationary nodes. Assign StationaryMovement as the mobility model for all but the first group. Note that you would need to specify the location of the individual stationary nodes.
Hi Barun,
ReplyDeleteThanks a lot for making such a helpful blog.
Can you please tell me how can I generate a message where I can fix the source and destination of the message. Right now the default configuration file allow me to create message randomly for any source and destination. But what if I would like to specify that only node x can create a message and the destination will be node y. Is there any way I can do it?
Thanks,
Shaahid
Shaahid,
DeleteThanks for your comment!
Try this:
# Events (message generator) source
# The lower bound is inclusive and upper bound exclusive
Events1.hosts = x, x+1
# Destination
Events1.tohosts = y, y+1
Hii
ReplyDeleteThnx for the tutorial:)
i am running ONE over Netbeans.. can you please give me some tips: how to see the reports of the routing algorithm?? where i can find the code where i can see each node which are the nodes that frequently met it(if it is possible)??
where i can start to understand the concet pf each routing algorithm??
thnx
Hussein
Hi Barun,
ReplyDeleteThanks a lot for the reply of my previous query. It worked perfectly. I am facing small problem in fixing the initial location of a mobile node.
Is there any way I can fix the initial location of a host. For example in Group 1, I have 10 host. Right now they are randomly distributed towards the map.
Can I set up an initial location in the two dimensional grid (coordinate) for host number x.
Thanks in advance...