hu.mta.sztaki.lpds.cloud.simulator.energy.powermodelling
Class PowerState

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.energy.powermodelling.PowerState

public class PowerState
extends Object

Represents a particular power state of a resource spreader

Author:
"Gabor Kecskemeti, Laboratory of Parallel and Distributed Systems, MTA SZTAKI (c) 2014"

Nested Class Summary
static class PowerState.ConsumptionModel
          By sub-classing this class one can define arbitrary consumption models.
static interface PowerState.PowerCharacteristicsChange
          allows notifications before the consumption characteristics would change.
 
Field Summary
private  double consumptionRange
          The power draw range in Watts (the maximum possible offset from minimum power draw)
private  ArrayList<PowerState.PowerCharacteristicsChange> listeners
          the list of those objects who are prepared to handle power state changes
private  double minConsumption
          The minimum instantaneous power draw in W
private  PowerState.ConsumptionModel model
          The current consumption model (which transforms the load to wattage based on the power state's charactheristics (e.g., mincons/range)
private  long pastNotification
          Records the last time in ticks when the power characteristics change was propagated to listeners
 
Constructor Summary
PowerState(double minConsumption, double consumptionRange, Class<? extends PowerState.ConsumptionModel> modelclass)
          Allow the creation of a new power state object with initial power state characteristics.
 
Method Summary
 double getConsumptionRange()
          Allows read access to the consumption range field
 double getCurrentPower(double load)
          determines the current power draw of the system given that it has the load specified in the parameter
 double getMinConsumption()
          allows read access to the minconsumption field
private  void notifyCharacteristisListeners()
          used to send out notifications before any of the power state characteristics change
 void setConsumptionRange(double cr)
          Allows to set the consumption range for this power state (good for DVFS and similar behavior).
 void setMinConsumption(double minConsumption)
          Allows to set the minimum consumption for this power state (good for DVFS and similar behavior).
 void subscribePowerCharacteristicsChanges(PowerState.PowerCharacteristicsChange listener)
          allows users of this powerstate object to get notifications about power state characteristics changes
 String toString()
          A convenient and compact way to represent the main characteristics of this power state.
 void unsubscribePowerCharacteristicsChanges(PowerState.PowerCharacteristicsChange listener)
          if some pary gets uninterested in power state changes this is the way to cancel event notifications about them
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minConsumption

private double minConsumption
The minimum instantaneous power draw in W


consumptionRange

private double consumptionRange
The power draw range in Watts (the maximum possible offset from minimum power draw)


pastNotification

private long pastNotification
Records the last time in ticks when the power characteristics change was propagated to listeners


model

private final PowerState.ConsumptionModel model
The current consumption model (which transforms the load to wattage based on the power state's charactheristics (e.g., mincons/range)


listeners

private final ArrayList<PowerState.PowerCharacteristicsChange> listeners
the list of those objects who are prepared to handle power state changes

Constructor Detail

PowerState

public PowerState(double minConsumption,
                  double consumptionRange,
                  Class<? extends PowerState.ConsumptionModel> modelclass)
           throws InstantiationException,
                  IllegalAccessException,
                  NoSuchFieldException,
                  SecurityException
Allow the creation of a new power state object with initial power state characteristics.

Parameters:
minConsumption - The minimum consumption that could be reported by this powerstate (e.g. idle power if we define a Physical Machine's powerstate) - in watts
consumptionRange - The maximum offset of the consumption that could be still reported by this power state object. (e.g., the max-idle power if we define a Physical Machine) - in watts
modelclass - Defines the consumption model which transforms a load value and is capable of outputting arbitrary instantaneous power draw estimates between minConsumption and minConsumption+consumptionRange
Throws:
InstantiationException - if the modelclass is not existent
IllegalAccessException - if the modelclass is not accessible
NoSuchFieldException - if the modelclass does not have a myPowerState field (this is most likely impossible as all subclasses will have that field because of the baseclass)
SecurityException - if visibility changes are not possible to do on the myPowerState field
Method Detail

getCurrentPower

public double getCurrentPower(double load)
determines the current power draw of the system given that it has the load specified in the parameter

Parameters:
load - for which load value should we use the consumption model to determine the instantaneous power draw of the system. the load value is expected to be within the range of [0..1]
Returns:
the estimated instantaneous power draw value in watts

getMinConsumption

public double getMinConsumption()
allows read access to the minconsumption field

Returns:
the minconsumption of this power state

getConsumptionRange

public double getConsumptionRange()
Allows read access to the consumption range field

Returns:
the consumption range of this power state

notifyCharacteristisListeners

private void notifyCharacteristisListeners()
used to send out notifications before any of the power state characteristics change


setMinConsumption

public void setMinConsumption(double minConsumption)
Allows to set the minimum consumption for this power state (good for DVFS and similar behavior). Before the change the power state change listeners are notified.

Parameters:
minConsumption - the new consumption value to be set in W

setConsumptionRange

public void setConsumptionRange(double cr)
Allows to set the consumption range for this power state (good for DVFS and similar behavior). Before the change the power state change listeners are notified.

Parameters:
cr - the new consumption range value to be set in W

subscribePowerCharacteristicsChanges

public void subscribePowerCharacteristicsChanges(PowerState.PowerCharacteristicsChange listener)
allows users of this powerstate object to get notifications about power state characteristics changes

Parameters:
listener - the object where the events should be sent

unsubscribePowerCharacteristicsChanges

public void unsubscribePowerCharacteristicsChanges(PowerState.PowerCharacteristicsChange listener)
if some pary gets uninterested in power state changes this is the way to cancel event notifications about them

Parameters:
listener - the object which no longer needs notification event

toString

public String toString()
A convenient and compact way to represent the main characteristics of this power state. Good for debugging and tracing

Overrides:
toString in class Object


Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.