Commit c1b660b9 authored by Anton Beloglazov's avatar Anton Beloglazov

- Fixed energy calculation: if fromUtilization == 0 and toUtilization == 0, it's…

- Fixed energy calculation: if fromUtilization == 0 and toUtilization == 0, it's assumed that the host is switched off and therefore energy is 0.
parent f7f3f15a
...@@ -101,6 +101,9 @@ public class PowerHost extends HostDynamicWorkload { ...@@ -101,6 +101,9 @@ public class PowerHost extends HostDynamicWorkload {
* @return the energy * @return the energy
*/ */
public double getEnergyLinearInterpolation(double fromUtilization, double toUtilization, double time) { public double getEnergyLinearInterpolation(double fromUtilization, double toUtilization, double time) {
if (fromUtilization == 0 && toUtilization == 0) {
return 0;
}
double fromPower = getPower(fromUtilization); double fromPower = getPower(fromUtilization);
double toPower = getPower(toUtilization); double toPower = getPower(toUtilization);
return (fromPower + (toPower - fromPower) / 2) * time; return (fromPower + (toPower - fromPower) / 2) * time;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment