Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to calculate the cost of the cloud in iFogSim?

Description

If any application module run on the cloud device then the cost of the cloud is estimated. The “FogDevice.java” abstract class should be extended and “updateEnergyConsumption()” abstract methods have to implement for calculate the cost execution in cloud.

Source Code

private void updateEnergyConsumption() {

double totalMipsAllocated = 0;

for(final Vm vm : getHost().getVmList()){

AppModule operator = (AppModule)vm;

operator.updateVmProcessing(CloudSim.clock(), getVmAllocationPolicy().getHost(operator).getVmScheduler()

.getAllocatedMipsForVm(operator));

totalMipsAllocated += getHost().getTotalAllocatedMipsForVm(vm);

}

double timeNow = CloudSim.clock();

double currentCost = getTotalCost();

double newcost = currentCost + (timeNow-lastUtilizationUpdateTime)*getRatePerMips()*lastUtilization*getHost().getTotalMips();

setTotalCost(newcost);

lastUtilization = Math.min(1, totalMipsAllocated/getHost().getTotalMips());

lastUtilizationUpdateTime = timeNow;

}

private void printPowerDetails() {

for(FogDevice fogDevice : getFogDevices()){

System.out.println(fogDevice.getName() + " : Energy Consumed = " + fogDevice.getEnergyConsumption());

}

}

Output

Calculate the cost of the cloud in iFogSim