|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthu.mta.sztaki.lpds.cloud.simulator.energy.powermodelling.PowerState
public class PowerState
Represents a particular power state of a resource spreader
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 |
---|
private double minConsumption
private double consumptionRange
private long pastNotification
private final PowerState.ConsumptionModel model
private final ArrayList<PowerState.PowerCharacteristicsChange> listeners
Constructor Detail |
---|
public PowerState(double minConsumption, double consumptionRange, Class<? extends PowerState.ConsumptionModel> modelclass) throws InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException
minConsumption
- The minimum consumption that could be reported by this
powerstate (e.g. idle power if we define a Physical Machine's
powerstate) - in wattsconsumptionRange
- 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 wattsmodelclass
- Defines the consumption model which transforms a load value
and is capable of outputting arbitrary instantaneous power
draw estimates between minConsumption and
minConsumption+consumptionRange
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 fieldMethod Detail |
---|
public double getCurrentPower(double load)
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]
public double getMinConsumption()
public double getConsumptionRange()
private void notifyCharacteristisListeners()
public void setMinConsumption(double minConsumption)
minConsumption
- the new consumption value to be set in Wpublic void setConsumptionRange(double cr)
cr
- the new consumption range value to be set in Wpublic void subscribePowerCharacteristicsChanges(PowerState.PowerCharacteristicsChange listener)
listener
- the object where the events should be sentpublic void unsubscribePowerCharacteristicsChanges(PowerState.PowerCharacteristicsChange listener)
listener
- the object which no longer needs notification eventpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |