Class PowerModelAbstract
java.lang.Object
org.cloudbus.cloudsim.power.models.PowerModelAbstract
- All Implemented Interfaces:
PowerAware
,PowerModel
- Direct Known Subclasses:
PowerModelSimple
,PowerModelSpecPower
public abstract class PowerModelAbstract extends java.lang.Object implements PowerModel
An abstract implementation of a
PowerModel
.- Since:
- CloudSim Plus 1.2.0
- Author:
- raysaoliveira
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PowerModelAbstract()
-
Method Summary
Modifier and Type Method Description double
getEnergyLinearInterpolation(double fromUtilization, double toUtilization, double time)
Gets an estimation of energy consumption using linear interpolation of the utilization change for a given time interval.Host
getHost()
double
getPower()
Gets the current power supply in Watts (w).double
getPower(double utilization)
Gets the power supply in Watts (W), according to the utilization percentage of a critical resource, such as CPU (which is currently the only resource considered).protected abstract double
getPowerInternal(double utilization)
An internal method to be implemented by sub classes to get the power supply for the current CPU utilization.void
setHost(Host host)
-
Constructor Details
-
PowerModelAbstract
public PowerModelAbstract()
-
-
Method Details
-
getHost
- Specified by:
getHost
in interfacePowerModel
-
setHost
- Specified by:
setHost
in interfacePowerModel
-
getPower
public double getPower()Description copied from interface:PowerAware
Gets the current power supply in Watts (w).- Specified by:
getPower
in interfacePowerAware
- Returns:
- the power supply in Watts (w)
- See Also:
PowerAware.getPowerInKWatts()
-
getPower
public final double getPower(double utilization) throws java.lang.IllegalArgumentExceptionDescription copied from interface:PowerModel
Gets the power supply in Watts (W), according to the utilization percentage of a critical resource, such as CPU (which is currently the only resource considered).- Specified by:
getPower
in interfacePowerModel
- Parameters:
utilization
- the utilization percentage (between [0 and 1]) of a resource that impacts power supply.- Returns:
- the power supply in Watts (W)
- Throws:
java.lang.IllegalArgumentException
- when the utilization percentage is not between [0 and 1]
-
getPowerInternal
protected abstract double getPowerInternal(double utilization) throws java.lang.IllegalArgumentExceptionAn internal method to be implemented by sub classes to get the power supply for the current CPU utilization.The basic parameter validation is performed by the
getPower(double)
method.- Parameters:
utilization
- the utilization percentage (between [0 and 1]) of a resource that is critical for power supply.- Returns:
- the power supply for the given CPU utilization
- Throws:
java.lang.IllegalArgumentException
- when the utilization percentage is not between [0 and 1]
-
getEnergyLinearInterpolation
public double getEnergyLinearInterpolation(double fromUtilization, double toUtilization, double time)Description copied from interface:PowerModel
Gets an estimation of energy consumption using linear interpolation of the utilization change for a given time interval. It's required to set aPowerModel
in order to get power usage data.- Specified by:
getEnergyLinearInterpolation
in interfacePowerModel
- Parameters:
fromUtilization
- the initial utilization percentagetoUtilization
- the final utilization percentagetime
- the time span (in seconds) between the initial and final utilization to compute the energy consumption- Returns:
- the estimated energy consumption in Watts-sec (Ws)
-