UtilizationModelDynamic

public class UtilizationModelDynamic extends UtilizationModelAbstract

A Cloudlet UtilizationModel that allows to increase the utilization of the related resource along the simulation time. It accepts a Lambda Expression that defines how the utilization increment must behave. By this way, the class enables the developer to define such a behaviour when instantiating objects of this class.

For instance, it is possible to use the class to arithmetically or geometrically increment resource usage, but any kind of increment as logarithmic or exponential is possible. For more details, see the setUtilizationUpdateFunction(Function).

Author:Manoel Campos da Silva Filho

Constructors

UtilizationModelDynamic

public UtilizationModelDynamic()

Creates a UtilizationModelDynamic with no initial utilization and resource utilization unit defined in Unit.PERCENTAGE.

The utilization will not be dynamically incremented until an increment function is defined by the .

See also: .setUtilizationUpdateFunction(Function)

UtilizationModelDynamic

public UtilizationModelDynamic(Unit unit)

Creates a UtilizationModelDynamic with no initial utilization and resource utilization Unit be defined according to the given parameter.

The utilization will not be dynamically incremented until that an increment function is defined by the .

Parameters:
  • unit – the Unit that determines how the resource is used (for instance, if resource usage is defined in percentage of the Vm resource or in absolute values)

UtilizationModelDynamic

public UtilizationModelDynamic(double initialUtilizationPercent)

Creates a UtilizationModelDynamic that the initial resource utilization will be defined according to the given parameter and the Unit will be set as Unit.PERCENTAGE.

The utilization will not be dynamically incremented until that an increment function is defined by the .

Parameters:
  • initialUtilizationPercent – the initial percentage of resource utilization

UtilizationModelDynamic

public UtilizationModelDynamic(Unit unit, double initialUtilization)

Creates a UtilizationModelDynamic that the initial resource utilization and the Unit will be defined according to the given parameters.

The utilization will not be dynamically incremented until that an increment function is defined by the .

Parameters:
  • unit – the Unit that determines how the resource is used (for instance, if resource usage is defined in percentage of the Vm resource or in absolute values)
  • initialUtilization – the initial resource utilization, that the unit depends on the unit parameter

UtilizationModelDynamic

public UtilizationModelDynamic(Unit unit, double initialUtilization, double maxResourceUtilization)

Creates a UtilizationModelDynamic that the initial resource utilization, max resource utilization and the Unit will be defined according to the given parameters.

The utilization will not be dynamically incremented until that an increment function is defined by the .

Parameters:
  • unit – the Unit that determines how the resource is used (for instance, if resource usage is defined in percentage of the Vm resource or in absolute values)
  • initialUtilization – the initial resource utilization, that the unit depends on the unit parameter
  • maxResourceUtilization – the maximum resource utilization

UtilizationModelDynamic

protected UtilizationModelDynamic(UtilizationModelDynamic source)

A copy constructor that creates a read-only UtilizationModelDynamic based on a source object.

Parameters:
  • source – the source UtilizationModelDynamic to create an instance from

UtilizationModelDynamic

public UtilizationModelDynamic(UtilizationModelDynamic source, double initialUtilization)

A copy constructor that creates a UtilizationModelDynamic based on a source object.

Parameters:
  • source – the source UtilizationModelDynamic to create an instance from
  • initialUtilization – the initial resource utilization (in the same unit of the given UtilizationModelDynamic instance)

Methods

getMaxResourceUtilization

public double getMaxResourceUtilization()

Gets the maximum amount of resource that will be used.

Such a value can be a percentage in scale from [0 to 1] or an absolute value, depending on the getUnit().

Returns:the maximum resource utilization

getTimeSpan

public double getTimeSpan()

Gets the time difference from the current simulation time to the last time the resource utilization was updated.

getUtilization

public double getUtilization(double time)

{@inheritDoc}

It will automatically increment the getUtilization() by applying the increment function.

Parameters:
Returns:

{@inheritDoc}

getUtilization

public double getUtilization()

setMaxResourceUtilization

public final UtilizationModelDynamic setMaxResourceUtilization(double maxResourceUsagePercentage)

Sets the maximum amount of resource that will be used.

Such a value can be a percentage in scale from [0 to 1] or an absolute value, depending on the getUnit().

Parameters:
  • maxResourceUsagePercentage – the maximum resource usage

setUtilizationUpdateFunction

public final UtilizationModelDynamic setUtilizationUpdateFunction(Function<UtilizationModelDynamic, Double> utilizationUpdateFunction)

Sets the function defining how the resource utilization will be incremented or decremented along the time.

Such a function must require one UtilizationModelDynamic parameter and return the new resource utilization. When this function is called internally by this UtilizationModel, it receives a read-only UtilizationModelDynamic instance and allow the developer using this UtilizationModel to define how the utilization must be updated.

For instance, to define an arithmetic increment, a Lambda function to be given to this setter could be defined as below:

um -> um.getUtilization() + um.getTimeSpan()*0.1

Considering the UtilizationModel Unit was defined in Unit.PERCENTAGE, such a Lambda Expression will increment the usage in 10% for each second that has passed since the last time the utilization was computed.

The value returned by the given Lambda Expression will be automatically validated to avoid negative utilization or utilization over 100% (when the UtilizationModel unit is defined in percentage). The function would be defined to decrement the utilization along the time, by just changing the plus to a minus signal.

Defining a geometric progression for the resource utilization is as simple as changing the plus signal to a multiplication signal.

Parameters:
  • utilizationUpdateFunction – the utilization increment function to set, that will receive the UtilizationModel instance and must return the new utilization value based on the previous utilization.