Skip to main content

The ONE Tutorial

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?

The ONE is quite young a simulator, which is not surprising considering the fact that DTN itself is still evolving. The ONE has been used by many researchers as part of their work. However, apart from the README that comes with this software, its website and mailing lists, there is not much information about the simulator available publicly. As a beginner, I myself stumbled over a lot while trying to create a simple scenario with a few mobile nodes! This prompted me to write this tutorial, so that others need not face the same trouble.

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 version that we would be using is 1.4.1. The currently available version is 1.5-RC2. Instructions regarding how to do this can be found in the official site of the ONE listed above.

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.
  1. Specify the general settings for the scenario to be simulated
  2. Specify the network interface(s) of the nodes
  3. Create a group of nodes
  4. Specify the motion patterns
  5. Specify the traffic pattern
  6. 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.txt
Note 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 = 1
We 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 = n
Thus, 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 #)
We will use the first method here. The second method is quite useful if we wish to import data generated by any other application. ONE, however, also provides a PERL script to generate such traffics.
## 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 = MessageStatsReport
Thus, 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 -b
The 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 = n
Figure-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



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

Comments

  1. Dear Barun
    I 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

    ReplyDelete
  2. Somoy,

    Am 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

    ReplyDelete
  3. Hmm. I shall try there then. Thx.

    ReplyDelete
  4. when i am running ONE in eclipse i have got this error:-
    Can't start: error in configuration file(s)
    Can't find setting 'Scenario.nrofHostGroups'

    so what can i do now tell me ASAP.

    ReplyDelete
  5. I too faced the same problem but finally got the solution....
    You 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

    ReplyDelete
    Replies
    1. how to convert the exported map in www.openstreetmap.org site extension to osm wk thank you

      Delete
  6. how to convert the exported map in www.openstreetmap.org site extension to osm wk thank you

    ReplyDelete
    Replies
    1. ONE has a software called OSM2WKT. try it...

      Delete
  7. I would the link to download osm2wkt ? please

    ReplyDelete
  8. please i want softward osmtowkt plzzzzzzzzzzzzzzzzzzzz some one can help me

    ReplyDelete
  9. How and where to configure Hop counts in ONE running on Eclipse?

    Thanks,
    Tejas

    ReplyDelete
    Replies
    1. Hi Tejas,

      Currently, 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.

      Delete
  10. 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?

    ReplyDelete
    Replies
    1. Hi Alex,

      Information 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.

      Delete
  11. To All Respected Researchers,

    Anyone 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

    ReplyDelete
  12. how to implement multicasting in ONE

    ReplyDelete
  13. the default scale reference in ONE is 100 metres...how to change the scale to any desired value??
    plzz help

    ReplyDelete
  14. For example,
    I 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

    ReplyDelete
    Replies
    1. Ranjana,

      You 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

      Delete
  15. do you know how to modify broadcast mechanism on epidemic routing?

    ReplyDelete
    Replies
    1. Denar,

      If 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.

      Delete
    2. ok thanks,

      barun,

      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

      Delete
    3. 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.

      RWP 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).

      Delete
    4. 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.

      Delete
  16. Good Teaching!! By Blogger!!!Thanks Man!! It's Nice If you can give more tutorial on this!

    ReplyDelete
  17. Hi! Thanks for this tutorial. I was wondering if you knew how to let the simulation go into batch mode in eclipse. Thanks!

    ReplyDelete
    Replies
    1. Bill,

      Thanks 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/

      Delete
  18. Hi, 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?

    ReplyDelete
  19. Hi! 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.

    ReplyDelete
    Replies
    1. Thanks for your comment!

      The 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.

      Delete
  20. this tutorial is really very helpful...
    thanks a lot sir.

    ReplyDelete
  21. @Barun
    Pls how do i implement other routing protocol i:e Prophet Routing. i Follow this tutorial and it was really helpful.

    thanks alot.

    ReplyDelete
    Replies
    1. Salawudeen,

      Thanks 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.

      Delete
    2. Hi
      Please 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 ???

      Delete
  22. Barun Saha, how can I reporting the time and the location that each messages were generated?

    ReplyDelete
  23. Tailan,

    Use MessageReport to obtain the message creation times. Extend the report to print the location of the nodes creating while the messages are created.

    ReplyDelete
  24. Dear Barun,

    Thank 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.

    ReplyDelete
    Replies
    1. Karim,

      Of 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.

      Delete
  25. Hi Barun,

    Thanks 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

    ReplyDelete
    Replies
    1. Shaahid,

      Thanks 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

      Delete
  26. Hii
    Thnx 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

    ReplyDelete
  27. Hi Barun,

    Thanks 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...

    ReplyDelete

Popular posts from this blog

Text Highlighting in Latex

While preparing a manuscript with Latex, it is often useful to highlight the changes made in the current revision with a different color. This can be achieved using the \ textcolor command provided by Latex. For example, \textcolor {red}{Hello World} would display the string "Hello World" in red color. However, the final/published copy of the manuscript does not contain any highlighted text. Therefore, if a large volume of changes were made, it becomes tiresome at the end to find and remove all the individual portions of highlighted text. This can be circumvented by defining a utility command to switch highlighting on and off as desired. In the following, we define a new Latex command, highlighttext , for this purpose. The command takes only a single argument—the text to be highlighted.     \usepackage {color}    % For highlighting changes in this version with red color   \newcommand { \highlighttext }[1] { \textcolor {red}{#1}}   % Remove all text highlighting

The ONE KB has a new home

The ONE Knowledge Base is now hosted at http://theonekb.pythonanywhere.com/ If you are unaware, the ONE KB allows you to search the old email archives of the simulator's community. Therefore, if you have any question related to simulation, you may query the existing database at the above link. Chances are good that your question might already have been answered previously. If not, you can still post an email to the community's mailing list. Have you tried the ONE KB already? How was your experience? Was it helpful? Let me know in the comments!

Specifying Source and Destination of Messages

One of the frequently asked questions in the community is how to specify which particular nodes would act as source(s) and destination(s) of the messages created in the ONE simulator. The simulator, in fact, provides a pair of settings (shown below in bold face) aimed for this particular purpose. Let us consider that there are $n + 1$ nodes in an OMN.  Further, let the nodes with addresses from $x$ to $y$, both inclusive, would create messages. The nodes in the range $w$ to $z$, both inclusive, would be the destinations of those messages, where $0 \le x \le y \le n$, and $0 \le w \le z \le n$. Then, the corresponding simulation scenario can be configured as follows. ## 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