Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

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

Social List

How to calculate Energy consumption in iFogSim?

Description

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

setEnergyConsumption(newEnergyConsumption);

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

lastUtilizationUpdateTime = timeNow;

}

private FogDevice getCloud(){

for(FogDevice dev : getFogDevices())

if(dev.getName().equals("cloud"))

return dev;

return null;

}

private void printCostDetails(){

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

}

Output

Calculate Energy consumption in iFogSim