Class UtilizationModelAbstract

java.lang.Object
org.cloudbus.cloudsim.utilizationmodels.UtilizationModelAbstract
All Implemented Interfaces:
UtilizationModel
Direct Known Subclasses:
UtilizationModelDynamic, UtilizationModelFull, UtilizationModelPlanetLab, UtilizationModelStochastic

public abstract class UtilizationModelAbstract extends Object implements UtilizationModel
An abstract implementation of UtilizationModel.
Since:
CloudSim Plus 1.2
Author:
Manoel Campos da Silva Filho
  • Field Details

    • ALMOST_ZERO

      public static final double ALMOST_ZERO
      Indicates that values lower or equal to this will be considered as zero.
      See Also:
  • Constructor Details

    • UtilizationModelAbstract

      public UtilizationModelAbstract()
    • UtilizationModelAbstract

      public UtilizationModelAbstract(UtilizationModel.Unit unit)
  • Method Details

    • getSimulation

      public Simulation getSimulation()
      Description copied from interface: UtilizationModel
      Gets the simulation that this UtilizationModel belongs to.
      Specified by:
      getSimulation in interface UtilizationModel
      Returns:
    • getUnit

      public UtilizationModel.Unit getUnit()
      Description copied from interface: UtilizationModel
      Gets the UtilizationModel.Unit in which the resource utilization is defined.
      Specified by:
      getUnit in interface UtilizationModel
      Returns:
    • setUnit

      protected final UtilizationModel setUnit(UtilizationModel.Unit unit)
      Sets the UtilizationModel.Unit in which the resource utilization is defined.
      Parameters:
      unit - UtilizationModel.Unit to set
      Returns:
    • setSimulation

      public UtilizationModel setSimulation(Simulation simulation)
      Description copied from interface: UtilizationModel
      Sets the simulation that this UtilizationModel belongs to.
      Specified by:
      setSimulation in interface UtilizationModel
      Parameters:
      simulation - the Simulation instance to set
      Returns:
    • getUtilization

      public final double getUtilization()
      Description copied from interface: UtilizationModel
      Gets the expected utilization of resource at the current simulation time. Such a value can be a percentage in scale from 0..1 or an absolute value, depending on the UtilizationModel.getUnit().

      It is an expected usage value because the actual Cloudlet resource usage depends on the available Vm resource.

      Specified by:
      getUtilization in interface UtilizationModel
      Returns:
      the current resource utilization
      See Also:
    • getUtilization

      public final double getUtilization(double time)
      Description copied from interface: UtilizationModel
      Gets the expected utilization of resource at a given simulation time. Such a value can be a percentage in scale from 0..1 or an absolute value, depending on the UtilizationModel.getUnit().

      It is an expected usage value because the actual Cloudlet resource usage depends on the available Vm resource.

      Specified by:
      getUtilization in interface UtilizationModel
      Parameters:
      time - the time to get the resource usage.
      Returns:
      the resource utilization at the given time
      See Also:
    • getUtilizationInternal

      protected abstract double getUtilizationInternal(double time)
    • validateUtilizationField

      protected void validateUtilizationField(String fieldName, double fieldValue)
      Checks if a given field has a valid value, considering that the minimum value is zero.
      Parameters:
      fieldName - the name of the field to display at the Exception when the value is invalid
      fieldValue - the current value of the field
    • validateUtilizationField

      protected void validateUtilizationField(String fieldName, double fieldValue, double minValue)
    • isOverCapacityRequestAllowed

      public boolean isOverCapacityRequestAllowed()
      Description copied from interface: UtilizationModel
      Checks if the resource utilization requested by a Cloudlet is allowed to exceed 100% or not.

      WARNING: This attribute is just considered when the UtilizationModel.getUnit() is defined as UtilizationModel.Unit.PERCENTAGE.

      Specified by:
      isOverCapacityRequestAllowed in interface UtilizationModel
      Returns:
      true if Cloudlets can request more than 100% of a resource, false otherwise
      See Also:
    • setOverCapacityRequestAllowed

      public UtilizationModel setOverCapacityRequestAllowed(boolean allow)
      Description copied from interface: UtilizationModel
      Allow the resource utilization requested by a Cloudlet to exceed 100% or not.

      The VM's CloudletScheduler won't allocate more resources than there is available, showing a warning if such a request is received. While requesting more than 100% of a resource may be useful to try simulating an overloading scenario, in other ones it may not be desired. You may want your Cloudlets to request the maximum of 100% of a given resource. In such a case, you can disable this attribute and the UtilizationModel.getUtilization(double) method will only return values strictly between the closed range [0..1]. If a value greater than 1 is generated, it's returned 1.

      For specific implementations such as the UtilizationModelPlanetLab (which reads data from a trace file that may be manipulated) and UtilizationModelStochastic (which generates utilization values randomly), the model may return values greater than 1 (100%). In such cases, you may consider disabling this attribute if you don't want such a behaviour.

      WARNING: This attribute is just considered when the UtilizationModel.getUnit() is defined as UtilizationModel.Unit.PERCENTAGE.

      Specified by:
      setOverCapacityRequestAllowed in interface UtilizationModel
      Parameters:
      allow - true to allow requesting more than 100% of a resource, false to disallow that
      Returns: