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