Skip to main content

Controlling Transmission Range from within the Simulation

While simulating scenarios with the ONE simulator, one typically defines one or more network interfaces, and add them to the nodes as required. This use case prevails in most of the scenarios. However, a drawback here is that different network interfaces are mutually incompatible — an interface of type 1 can't communicate with any interface not of type 1.

Under certain circumstances, it might be required to control the transmission range of one or more network interfaces dynamically from within the simulation. For example, in one of my works, "On emotional aspects in Mission-Oriented Opportunistic Networks", I have considered the case where users occasionally turn off their device radios based on their contemporary emotions. In particular, the following shows how to set the radio range to 0:
ModuleCommunicationBus comBus = host.getComBus();

// Store the original radio range the first time it is reset
if (this.originalRadioRange == -1) {
 this.originalRadioRange = Double.valueOf(
   (Double) comBus

// If the radio was made OFF, restore the radio
double range = (Double) comBus.getProperty(NetworkInterface.RANGE_ID);

// Some related logic here ... skipped

if (range == 0.0) {
Here, the original radio range (set in the settings file) is stored the first time the code is executed. Next, the NetworkInterface.RANGE_ID property is used to retrieve/update the current transmission range. Use this code along with your logic to change the transmission range.

Update (06 June 2014):

The above code snippet is unlikely to be written in the NetworkInterface class. One can incorporate this into his/her own routing/application module. However, this should not be written inside any constructor or any method invoked by the constructor. A suitable candidate would be the update() method with some checks.

Update (23 December 2016):

The method described above would not work for nodes that have more than one network interface.


  1. I want to create two interfaces:
    1. for cars . it has lower range , say 30m
    2. for special type of nodes which can take message from car and send it to other car or to same special node. it would have higher range say 200m.

    How can i implement it. Please help.

    1. You can create two different types of network interfaces in simulation scenario. However, they would be incompatible. Alternatively, reduce/increase the transmission range of the relevant nodes dynamically once the simulation begins as discussed above.

    2. In which .java file i have to implement it. Please explain more about implementation and how can i achieve my objective. i am confused.

  2. How can i obtain contact time at first node using ONE simulator

  3. Hi Barun,
    I want to create my own message event generator. Do I have to register this class with the simualtor? If yes, then how? Please help me with this.


Post a Comment

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

Commonly Used Metrics for Performance Evaluation

The following metrics are commonly used when evaluating scenarios related to DTN protocols. Delivery ratio of the messages, Average message delivery latency Overhead ratio (of the underlying routing mechanism) Suppose that $M$ be the set of all messages created in the network and $M_d$ be the set of all messages delivered. Then, the delivery ratio is computed as $|M_d| / |M|$. Now let the $i^{th}$ delivered message was created at time $c_i$ and delivered at time $d_i$. Then the average message delivery latency is computed as $(\sum_{i = 1}^{|M_d|} (d_i - c_i)) / |M_d|$. Note that, in Statistics, mean, median and mode are all the measures of average. But "loosely speaking", unless otherwise specified, we refer to the "mean" value when we say "average." Nevertheless, the MessageStatsReport in the ONE simulator provides a measure of both the mean and median values wherever appropriate. One may refer the above metric as "end-to-end delay.

The ONE KB has a new home

The ONE Knowledge Base is now hosted at 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!