Amazing technological breakthrough possible @S-Logix

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • +91- 81240 01111

Social List

How to calculate Energy consumption in iFogSim?


The energy consumption of fog device is calculated by the power of all hosts in a certain time frame of execution. The “UpdateEnergyConsumption” method in FogDevice class is used to calculate the energy consumption, it is the extension of PowerDatacenter class.

Source Code

private void updateEnergyConsumption() {

double totalMipsAllocated = 0;

double timeNow = CloudSim.clock();

double currentEnergyConsumption = getEnergyConsumption();

double newEnergyConsumption = currentEnergyConsumption + (timeNow-lastUtilizationUpdateTime)*getHost().getPowerModel().getPower(lastUtilization);


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

lastUtilizationUpdateTime = timeNow;


private FogDevice getCloud(){

for(FogDevice dev : getFogDevices())


return dev;

return null;


private void printCostDetails(){

System.out.println("Cost of execution in cloud = "+getCloud().getTotalCost());



Calculate Energy consumption in iFogSim