Search code examples
javasimulationone-simulator

Stop movement of a node in one simulator


How to stop movement of a particular node in One Simulator? Speed settings are found in default_settings.txt .But how to change the speed of a node dynamically?


Solution

  • In this case, you can also use the other movement module in movement folder. Most of them are map-based movement, if you can provide corresponding map-based data, you can achieve "move for some time and stop thereafter".

    Meanwhile, writing your own movement module is an alternative method and it can be more effective in most cases. In ONE simulator, you need to know that the location of each node is updated in moveHosts(double timeIncrement) function in World.java. To realize your own movement logic, you need to rewrite move() function in DTNHost.java. A new movement module (e.g., MoveAndStop.java) which inherit MovementModel class in MovementModel.java and changes about Group.MovementModel=MoveAndStop.java in default_settings.txt are also required.

    Note that if you want to realize your own movement logic according to the current simulation time, you can call SimClock.getTime() function to get it.

    I hope my answer can inspire you to solve your problem.