some minor backward compatible, major backward incompatible changes and code formatting (beautification)
Minor Modifications: * Indentation issues are fixed * Typo errors in source code and comments are fixed * Misspelled parameters in plotTaskFailureReason.m are corrected * sim_results folder is added to .gitignore file Backward compatible changes * The exit code of the application when there is an error is changed from 0 to 1 * Default constructors are added for Location.java, LoadGeneratorModel.java, MobilityModel.java, EdgeOrchestrator.java (this change request coming from a developer) * public TaskProperty(int mobileDeviceId, double startTime, ExponentialDistribution[] expRngList) is added to TaskProperty.java (this change request coming from a developer to create a task without task type) * double getCreationTime() function is added to Task.java * void reconfigureMips(double mips) function is added to EdgeVM (for future usage) * gsm_propagation_delay variable is added to config file. SimSettings class is also modified accordingly. You can use it if you have cellular network access in your scenario. * wlan_range, northern_bound, southern_bound, eastern_bound, western_bound variables are added to config file; and relevant functions are added to SimSettings class. (this change request coming from a developer) Backward incompatible changes! * location_check_interval variable name is changed to location_check_interval in config.properties file. Please update your config files accordingly (remove 'vm_' part) * Major modifications are applied in SimLogger class to decrease time complexity. Now the basic results are kept in the memory and saved to the files at the end of the simulation. As a result of this change, the signature of the SimLogger.addLog () function had to be changed. You must add the mobile device id as the first argument. Please update your MobileDeviceManager class accordingly (add task.getCloudletId () as the first argument).
This commit is contained in:
@@ -24,7 +24,7 @@ public class MM1Queue extends NetworkModel {
|
||||
private double avgTaskInputSize; //bytes
|
||||
private double avgTaskOutputSize; //bytes
|
||||
private int maxNumOfClientsInPlace;
|
||||
|
||||
|
||||
public MM1Queue(int _numberOfMobileDevices, String _simScenario) {
|
||||
super(_numberOfMobileDevices, _simScenario);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class MM1Queue extends NetworkModel {
|
||||
avgTaskInputSize=0;
|
||||
avgTaskOutputSize=0;
|
||||
maxNumOfClientsInPlace=0;
|
||||
|
||||
|
||||
//Calculate interarrival time and task sizes
|
||||
double numOfTaskType = 0;
|
||||
SimSettings SS = SimSettings.getInstance();
|
||||
@@ -45,26 +45,26 @@ public class MM1Queue extends NetworkModel {
|
||||
double weight = SS.getTaskLookUpTable()[i][0]/(double)100;
|
||||
if(weight != 0) {
|
||||
WlanPoissonMean += (SS.getTaskLookUpTable()[i][2])*weight;
|
||||
|
||||
|
||||
double percentageOfCloudCommunication = SS.getTaskLookUpTable()[i][1];
|
||||
WanPoissonMean += (WlanPoissonMean)*((double)100/percentageOfCloudCommunication)*weight;
|
||||
|
||||
|
||||
avgTaskInputSize += SS.getTaskLookUpTable()[i][5]*weight;
|
||||
|
||||
|
||||
avgTaskOutputSize += SS.getTaskLookUpTable()[i][6]*weight;
|
||||
|
||||
|
||||
numOfTaskType++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WlanPoissonMean = WlanPoissonMean/numOfTaskType;
|
||||
avgTaskInputSize = avgTaskInputSize/numOfTaskType;
|
||||
avgTaskOutputSize = avgTaskOutputSize/numOfTaskType;
|
||||
}
|
||||
|
||||
/**
|
||||
* source device is always mobile device in our simulation scenarios!
|
||||
*/
|
||||
/**
|
||||
* source device is always mobile device in our simulation scenarios!
|
||||
*/
|
||||
@Override
|
||||
public double getUploadDelay(int sourceDeviceId, int destDeviceId, Task task) {
|
||||
double delay = 0;
|
||||
@@ -86,13 +86,13 @@ public class MM1Queue extends NetworkModel {
|
||||
else if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
|
||||
delay = getWlanUploadDelay(accessPointLocation, CloudSim.clock());
|
||||
}
|
||||
|
||||
|
||||
return delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* destination device is always mobile device in our simulation scenarios!
|
||||
*/
|
||||
/**
|
||||
* destination device is always mobile device in our simulation scenarios!
|
||||
*/
|
||||
@Override
|
||||
public double getDownloadDelay(int sourceDeviceId, int destDeviceId, Task task) {
|
||||
//Special Case -> edge orchestrator to edge device
|
||||
@@ -103,7 +103,7 @@ public class MM1Queue extends NetworkModel {
|
||||
|
||||
double delay = 0;
|
||||
Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(destDeviceId,CloudSim.clock());
|
||||
|
||||
|
||||
//cloud server to mobile device
|
||||
if(sourceDeviceId == SimSettings.CLOUD_DATACENTER_ID){
|
||||
double wlanDelay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock());
|
||||
@@ -114,57 +114,57 @@ public class MM1Queue extends NetworkModel {
|
||||
//edge device (wifi access point) to mobile device
|
||||
else{
|
||||
delay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock());
|
||||
|
||||
|
||||
EdgeHost host = (EdgeHost)(SimManager.
|
||||
getInstance().
|
||||
getEdgeServerManager().
|
||||
getDatacenterList().get(sourceDeviceId).
|
||||
getHostList().get(0));
|
||||
|
||||
|
||||
//if source device id is the edge server which is located in another location, add internal lan delay
|
||||
//in our scenario, serving wlan ID is equal to the host id, because there is only one host in one place
|
||||
if(host.getLocation().getServingWlanId() != accessPointLocation.getServingWlanId())
|
||||
delay += (SimSettings.getInstance().getInternalLanDelay() * 2);
|
||||
}
|
||||
|
||||
|
||||
return delay;
|
||||
}
|
||||
|
||||
|
||||
public int getMaxNumOfClientsInPlace(){
|
||||
return maxNumOfClientsInPlace;
|
||||
}
|
||||
|
||||
|
||||
private int getDeviceCount(Location deviceLocation, double time){
|
||||
int deviceCount = 0;
|
||||
|
||||
|
||||
for(int i=0; i<numberOfMobileDevices; i++) {
|
||||
Location location = SimManager.getInstance().getMobilityModel().getLocation(i,time);
|
||||
if(location.equals(deviceLocation))
|
||||
deviceCount++;
|
||||
}
|
||||
|
||||
|
||||
//record max number of client just for debugging
|
||||
if(maxNumOfClientsInPlace<deviceCount)
|
||||
maxNumOfClientsInPlace = deviceCount;
|
||||
|
||||
|
||||
return deviceCount;
|
||||
}
|
||||
|
||||
|
||||
private double calculateMM1(double propagationDelay, int bandwidth /*Kbps*/, double PoissonMean, double avgTaskSize /*KB*/, int deviceCount){
|
||||
double Bps=0, mu=0, lamda=0;
|
||||
|
||||
|
||||
avgTaskSize = avgTaskSize * (double)1000; //convert from KB to Byte
|
||||
|
||||
|
||||
Bps = bandwidth * (double)1000 / (double)8; //convert from Kbps to Byte per seconds
|
||||
lamda = ((double)1/(double)PoissonMean); //task per seconds
|
||||
lamda = ((double)1/(double)PoissonMean); //task per seconds
|
||||
mu = Bps / avgTaskSize ; //task per seconds
|
||||
double result = (double)1 / (mu-lamda*(double)deviceCount);
|
||||
|
||||
|
||||
result += propagationDelay;
|
||||
|
||||
|
||||
return (result > 5) ? -1 : result;
|
||||
}
|
||||
|
||||
|
||||
private double getWlanDownloadDelay(Location accessPointLocation, double time) {
|
||||
return calculateMM1(0,
|
||||
SimSettings.getInstance().getWlanBandwidth(),
|
||||
@@ -172,7 +172,7 @@ public class MM1Queue extends NetworkModel {
|
||||
avgTaskOutputSize,
|
||||
getDeviceCount(accessPointLocation, time));
|
||||
}
|
||||
|
||||
|
||||
private double getWlanUploadDelay(Location accessPointLocation, double time) {
|
||||
return calculateMM1(0,
|
||||
SimSettings.getInstance().getWlanBandwidth(),
|
||||
@@ -180,7 +180,7 @@ public class MM1Queue extends NetworkModel {
|
||||
avgTaskInputSize,
|
||||
getDeviceCount(accessPointLocation, time));
|
||||
}
|
||||
|
||||
|
||||
private double getWanDownloadDelay(Location accessPointLocation, double time) {
|
||||
return calculateMM1(SimSettings.getInstance().getWanPropagationDelay(),
|
||||
SimSettings.getInstance().getWanBandwidth(),
|
||||
@@ -188,7 +188,7 @@ public class MM1Queue extends NetworkModel {
|
||||
avgTaskOutputSize,
|
||||
getDeviceCount(accessPointLocation, time));
|
||||
}
|
||||
|
||||
|
||||
private double getWanUploadDelay(Location accessPointLocation, double time) {
|
||||
return calculateMM1(SimSettings.getInstance().getWanPropagationDelay(),
|
||||
SimSettings.getInstance().getWanBandwidth(),
|
||||
@@ -200,24 +200,24 @@ public class MM1Queue extends NetworkModel {
|
||||
@Override
|
||||
public void uploadStarted(Location accessPointLocation, int destDeviceId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadFinished(Location accessPointLocation, int destDeviceId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadStarted(Location accessPointLocation, int sourceDeviceId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadFinished(Location accessPointLocation, int sourceDeviceId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,26 +24,26 @@ public abstract class NetworkModel {
|
||||
numberOfMobileDevices=_numberOfMobileDevices;
|
||||
simScenario = _simScenario;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* initializes custom network model
|
||||
*/
|
||||
* initializes custom network model
|
||||
*/
|
||||
public abstract void initialize();
|
||||
|
||||
/**
|
||||
* calculates the upload delay from source to destination device
|
||||
*/
|
||||
|
||||
/**
|
||||
* calculates the upload delay from source to destination device
|
||||
*/
|
||||
public abstract double getUploadDelay(int sourceDeviceId, int destDeviceId, Task task);
|
||||
|
||||
/**
|
||||
* calculates the download delay from source to destination device
|
||||
*/
|
||||
|
||||
/**
|
||||
* calculates the download delay from source to destination device
|
||||
*/
|
||||
public abstract double getDownloadDelay(int sourceDeviceId, int destDeviceId, Task task);
|
||||
|
||||
/**
|
||||
* Mobile device manager should inform network manager about the network operation
|
||||
* This information may be important for some network delay models
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mobile device manager should inform network manager about the network operation
|
||||
* This information may be important for some network delay models
|
||||
*/
|
||||
public abstract void uploadStarted(Location accessPointLocation, int destDeviceId);
|
||||
public abstract void uploadFinished(Location accessPointLocation, int destDeviceId);
|
||||
public abstract void downloadStarted(Location accessPointLocation, int sourceDeviceId);
|
||||
|
||||
Reference in New Issue
Block a user