code refactoring and improvements

* saving log for each app type support
* colt library is used for poisson distribution
* Setting file structure is updated
* some bug fixes are applied
* new abstract functions are added to network manager for another
experimental study
This commit is contained in:
Cagatay Sonmez
2017-06-19 22:40:15 +03:00
parent 22b654d719
commit 138adb8f32
12 changed files with 618 additions and 360 deletions

View File

@@ -65,7 +65,7 @@ public class MM1Queue extends NetworkModel {
* source device is always mobile device in our simulation scenarios!
*/
@Override
public double getUploadDelay(int sourceDeviceId, int destDeviceId) {
public double getUploadDelay(int sourceDeviceId, int destDeviceId, double dataSize) {
double delay = 0;
Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(sourceDeviceId,CloudSim.clock());
@@ -93,7 +93,7 @@ public class MM1Queue extends NetworkModel {
* destination device is always mobile device in our simulation scenarios!
*/
@Override
public double getDownloadDelay(int sourceDeviceId, int destDeviceId) {
public double getDownloadDelay(int sourceDeviceId, int destDeviceId, double dataSize) {
//Special Case -> edge orchestrator to edge device
if(sourceDeviceId == SimSettings.EDGE_ORCHESTRATOR_ID &&
destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID){
@@ -155,11 +155,13 @@ public class MM1Queue extends NetworkModel {
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);
return result + propogationDelay;
result += propogationDelay;
return (result > 5) ? -1 : result;
}
private double getWlanDownloadDelay(Location accessPointLocation, double time) {
@@ -193,4 +195,28 @@ public class MM1Queue extends NetworkModel {
avgTaskInputSize,
getDeviceCount(accessPointLocation, time));
}
@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
}
}

View File

@@ -13,6 +13,8 @@
package edu.boun.edgecloudsim.network;
import edu.boun.edgecloudsim.utils.Location;
public abstract class NetworkModel {
protected int numberOfMobileDevices;
@@ -28,10 +30,19 @@ public abstract class NetworkModel {
/**
* calculates the upload delay from source to destination device
*/
public abstract double getUploadDelay(int sourceDeviceId, int destDeviceId);
public abstract double getUploadDelay(int sourceDeviceId, int destDeviceId, double dataSize);
/**
* calculates the download delay from source to destination device
*/
public abstract double getDownloadDelay(int sourceDeviceId, int destDeviceId);
public abstract double getDownloadDelay(int sourceDeviceId, int destDeviceId, double dataSize);
/**
* 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);
public abstract void downloadFinished(Location accessPointLocation, int sourceDeviceId);
}