How to create power model for Host

  • The power model is mainly used to calculate the power consumped by the Host. To use power model one should use the “PowerHost” class. In cloudsim there are many power models available, which can be directly used or can be extended and can implement one’s own power model. Here, the basic power model “PowerModelCubic” class is extended as “ModelPower” and in “getPower(double utilization)” method, model to calculate the power consumped for the given amount of resource utilization is calculated in “s”.
  • public class ModelPower extends PowerModelCubic{ double max=1; //Maximum amount of power a host can utilize double k=0.5; // 50% of the power is utilized when a host is in idle state. ……; ……..; public double getPower(double utilization) throws IllegalArgumentException { if (utilization < 0 || utilization > 1) { throw new IllegalArgumentException("Utilization value must be between 0 and 1"); } if (utilization == 0) { return 0; } double s=k*max+(1-k)*max*utilization; // Example Power Model. return s; } }