|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthu.mta.sztaki.lpds.cloud.simulator.Timed
hu.mta.sztaki.lpds.cloud.simulator.energy.EnergyMeter
hu.mta.sztaki.lpds.cloud.simulator.energy.DirectEnergyMeter
public class DirectEnergyMeter
Direct energy meters can monitor a single resource spreader and can convert their processed consumption values to a continuously updated energy figure.
Field Summary | |
---|---|
private double |
maxProcessable
the maximum amount of totalprocessed increase possible during the metering time interval. |
private ResourceSpreader |
measuredResource
the resource spreader that needs to be measured energywise |
private double |
previousProcessingReport
the last collected totalProcessed value from the meteredResource. |
private PowerState |
usedPowerState
the power state the particular measuredResource is in |
Fields inherited from class hu.mta.sztaki.lpds.cloud.simulator.energy.EnergyMeter |
---|
lastMetered |
Constructor Summary | |
---|---|
DirectEnergyMeter(ResourceSpreader spreader)
sets up the new meter. |
Method Summary | |
---|---|
void |
behaviorChanged(ResourceSpreader onSpreader,
PowerState newState)
on this function the meter receives notifications on power state changes of the particular resource spreader |
private double |
collectProcessingReport()
collects the total processed value from the measured resource spreader |
void |
prePowerChangeEvent(PowerState onMe)
if the power state of the resource spreader changes then the meter is readjusted for the new power state - this usually means the meter collects all uncolledted resource consumption related information from the spreader |
boolean |
startMeter(long interval,
boolean dropPriorReading)
starts the metering session for the particular resource spreader |
void |
stopMeter()
stops the metering session for the resource spreader |
void |
tick(long fires)
Maintains the totalconsumption value in every desired time interval |
String |
toString()
offers a convenient human readable output for debugging energy meters and their readings where both the metered resource and its currently reported total consumpiton is printed out |
private void |
updateFieldsUsingNewInterval(long interval)
The maxProcessable field is updated with the metering frequency specified here |
Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.energy.EnergyMeter |
---|
getMeteringStarted, getMeteringStopped, getTotalConsumption, increaseTotalConsumption, readjustMeter |
Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.Timed |
---|
calcTimeJump, compareTo, fire, getFireCount, getFrequency, getNextEvent, getNextFire, isSubscribed, jumpTime, nextEventDistance, resetTimed, setBackPreference, simulateUntil, simulateUntilLastEvent, skipEventsTill, subscribe, unsubscribe, updateFrequency |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private ResourceSpreader measuredResource
private PowerState usedPowerState
private double previousProcessingReport
private double maxProcessable
Constructor Detail |
---|
public DirectEnergyMeter(ResourceSpreader spreader)
spreader
- specifies the resource spreader to be monitored in the later
metering sessions.Method Detail |
---|
public String toString()
toString
in class Timed
public boolean startMeter(long interval, boolean dropPriorReading)
startMeter
in class EnergyMeter
interval
- The meter refresh frequency.dropPriorReading
- public void stopMeter()
stopMeter
in class EnergyMeter
public void behaviorChanged(ResourceSpreader onSpreader, PowerState newState)
behaviorChanged
in interface PowerBehaviorChangeListener
onSpreader
- the resource spreader which changed its power statenewState
- the new power state that is used by the spreader from now on.public void prePowerChangeEvent(PowerState onMe)
prePowerChangeEvent
in interface PowerState.PowerCharacteristicsChange
onMe
- with this parameter the change event propagates the power
state for which the change is happeningprivate void updateFieldsUsingNewInterval(long interval)
interval
- the metering period (in ticks)private double collectProcessingReport()
public void tick(long fires)
tick
in class Timed
fires
- The particular time instance when the function was called. The
time instance is passed so the tick functions will not need to
call getFireCount() if they need to operate on the actual
time.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |