Research breakthrough possible @S-Logix

Office Address

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

Social List

How to calculate the cost of the cloud in iFogSim?


If any application module run on the cloud device then the cost of the cloud is estimated. The “” 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()


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


double timeNow = CloudSim.clock();

double currentCost = getTotalCost();

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


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());




Calculate the cost of the cloud in iFogSim