Nomadic mobility model is used as default, you can create your own mobility model by extending “MobilityModel.java”file
1.Create a java class as “NewMobilityModel.java”
2.Extend “MobilityModel.java”class.
3.Add a constructor to “NewMobilityModel.java” class.
4.Implement initialize() method and write to calculate location of the devices according to your own mobility model.
5.Implement another method getLocation() to return location of a device at a certain time.
package edu.boun.edgecloudsim.mobility;
import edu.boun.edgecloudsim.utils.Location;
import java.util.List;
import java.util.TreeMap;
public class NewMobilityModel extends MobilityModel {
private List<TreeMap<Double, Location>> treeMapArray;
public NewMobilityModel(int numberOfMobileDevices, double simulationTime) {
super(numberOfMobileDevices, simulationTime);
}
@Override
public void initialize()
{
// own coding to locate mobility device
/* 1. create random number generator for each place
2.initialize tree maps and position of mobile devices
3.start locating user shortly after the simulation started.
*/
}
@Override
public Location getLocation(int deviceId, double time) {
return locationValue;
}
}
6.Add an object of our own mobility model into getMobilityModel() method of“ScenarioFactory.java”interface
package edu.boun.edgecloudsim.applications.sample_app1;
import ……..;
import ……..;
public class SampleScenarioFactory implements ScenarioFactory {
private int numOfMobileDevice;
private double simulationTime;
SampleScenarioFactory(){
}
. . . . . . . .
@Override
public MobilityModel getMobilityModel()
{
return new NewMobilityModel(numOfMobileDevice, simulationTime);
}
. . . . . . . .
}