ONE simulator introduction



The main intention of this article is to give an introduction to the ONE (Opportunistic Network Environment) simulator to the beginners in Windows platforms. Since the ONE provides very less documentation I hope this article may be useful to the beginners who aim to do their research work in Delay Tolerant Networks. 

To start with download the ONE simulator from the link given below. It is better to download one.1.4.1 or above.
  https://github.com/akeranen/the-one
Don’t forget to subscribe to the mailman link in the ONE page. Once you are subscribed you can clear any of your doubts with one of the best research community in DTN. 

Here are the steps below to make yourself familiar with ONE.



Setting Java Path Variable
After downloading you get a folder like one_1.4.1. Copy it to any directory in your system. Now, don’t expect to find a .exe because that is not how it starts. 

The pre-requisite for running ONE is to have a jdk in your system. And for one_1.4.1 it is better to use jdk_1.7.0 or above. After downloading and installing jdk set the java path in Environment variables. If you are not familiar with setting the Java path, the steps are given below:

 Go to My Computer. Right Click on Properties. Find Advanced System Settings - Environment Variables - System Varaiables - Path. Edit C:\Program Files\Java\jdk1.7.0\bin

 

 

 


 Don’t forget to separate the paths with a semicolon as shown in the figure.  


Compiling and running ONE 
After setting the Java path now we can compile the ONE. Since ONE is written completely in Java it is necessary to compile all the programs before running the simulator.  


When you got to the downloaded ONE folder you can see a list of folders each containing java files. In the ONE folder along with other folders you will see some .txt files also which are settings files. We’ll come to this later.

 

To compile the ONE simulator, now you have two ways.
1.      Double click on compile.bat OR
2.      Go to command prompt, give the path to the directory where you have saved ONE and type compile.bat and enter.
I suggest you to go with the second method because later when you start developing your own programs in ONE this will give errors on the prompt if you have any.
So once the compile.bat runs all the java files in the ONE get compiled. Before compiling you will only see .java files. Now you will get to see .class files also.

 

To run the ONE simulator also you have two ways.
1.      You can choose the GUI mode OR
2.      You can choose the batch mode.
Batch mode is recommended, but being a beginner it is better to go with GUI because it gives a feeling of what the simulation is.
I’ll explain the GUI first and then the batch mode.
To run the GUI double click on one.bat in your ONE folder or type one.bat in command prompt and enter. This will open up the GUI. Always remember this GUI is a running java code. So where is this code? You can find it in one_1.4.1\core\DTNSim.java. If you are a beginner don’t try to study the code at first. Try to learn more about running the ONE simulator. 

  

There will be a pause/play button on the top left side of GUI. Once you enter this the simulation starts.
On the top left corner you can see the Simulation clock. This is the clock of the simulator. By default it will run for 43200s. But in real it doesn’t take this much time, it is the time that the simulator is simulating according to it’s program.
You can also reduce the magnification by changing values in the field right to that magnification glass you see on top of the GUI.
Let’s have a closer look into the GUI. On the right side we have a section called nodes. You may see a lot of button below it like p0, p1 etc. These are the nodes that are running in the simulation. When you click each button it shows the location of that node on the map.
The map that the ONE simulator uses by default is the Helsinki city map. When you start developing your own programs you can change the maps also. That will be discussed in another article.
In the Event log section of the GUI the connections created, the messages transmitted etc can be seen.
These are some basics on the ONE GUI.
·         To run ONE in the batch mode. Type the following command in the command prompt.
one.bat –b 1

 

The real format of running in batch mode is:
one.bat –b <no:of times to run> <settings file path>
Let us understand what this means:
-b: this indicates that the simulation is to be run in the batch mode.
<no:of times to run>: this is always an integer and tells how many times this simulation is to be run. In our example we have given it as 1 because we need to run it only 1 time. There may be some cases where you may want to run your program for n number of times each with a different random seed. However as a beginner we will keep this value to 1.
<settings file path>: This give the path to the settings file that the simulator is running. By default the ONE uses the default_settings.txt as the settings file. You can see this in the one folder. If you need your own settings file, you can have that also. Give path to that file in this place of the command.

In the batch mode you will not be able to see the node’s location etc.
 
 Report Generation

Now after the ONE finishes the simulation where are the reports generated? Open the reports folder and the MessageStatsReport can be seen. In this report it is possible to see the delivery probability, average latency, overhead ratio etc for the current simulation. 


Settings
Let’s see more about the settings file. As an example we’ll take the default_settings.txt file.



#
# Default settings for the simulation
#
## Scenario settings
Scenario.name = default_scenario
Scenario.simulateConnections = true
Scenario.updateInterval = 0.1
# 43200s == 12h
Scenario.endTime = 43200
 
 

The # in the file indicates comments.
·         Scenario.name: The value set for this is the name we give for current simulation. For each simulation this value should be changed, otherwise the reports generated for each simulation will be replaced with the new contents. So if you want separate report files for each simulation change names here.
·         Scenario.simulateConnection: this should be set to true for simulations. In some cases we may use external traces (like those downloaded from CRAWDAD); in such cases the value is set to false.
·         Scenario.updateInterval: This defines the interval in which the update() function in the MessageRouter.java file has to be called. As default it is set to 0.1s.
·         Scenario.endTime: The time for which the scenario is to be simulated. You can keep it to any number of seconds. By default it is kept to 43200s which is 12hrs.

## 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
# High speed, long range, interface for group 4
highspeedInterface.type = SimpleBroadcastInterface
highspeedInterface.transmitSpeed = 10M
highspeedInterface.transmitRange = 1000
 

We can set interfaces as we like. The set of interfaces supported by ONE are given in interfaces folder.
·         Type: For a scenario we can give specific names to the interfaces we want. For example I want a Bluetooth type interface and a high speed interface. For distinguishing between the two I name the first as btInterface and the other highspeedInterface. The ONE should now understand the difference between two. We keep the type of both interfaces as SimpleBroadcastInterface and vary the parameters for each interface.
For example: we know Bluetooth won’t have a high transmission range and speed and so we keep their values low:

o    btInterface.transmitSpeed = 250k
o   btInterface.transmitRange = 10
      Also we need a high speed and long range interface and so it’s values we keep different.
o   highspeedInterface.transmitSpeed = 10M
o   highspeedInterface.transmitRange = 1000
Note that transmitSpeed and transmitRange are parameters for SimpleBroadcastInterface. For other interfaces there maybe other parameters.