hu.mta.sztaki.lpds.cloud.simulator.energy
Class EnergyMeter

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.Timed
      extended by hu.mta.sztaki.lpds.cloud.simulator.energy.EnergyMeter
All Implemented Interfaces:
Comparable<Timed>
Direct Known Subclasses:
AggregatedEnergyMeter, DirectEnergyMeter

public abstract class EnergyMeter
extends Timed


Field Summary
protected  long lastMetered
           
private  long meteringStarted
           
private  long meteringStopped
           
private  double totalConsumption
           
 
Constructor Summary
EnergyMeter()
           
 
Method Summary
 long getMeteringStarted()
          Allows the reading of the beginning time instance of the metering session If there were several metering sessions done by this meter, then this function reports the time instance when a hypothetical single continuous metering session would have started
 long getMeteringStopped()
          Enables access to the time when the last reading was stored for the last stopped metering session.
 double getTotalConsumption()
          Allows the reading of the meter's current consumption report.
protected  void increaseTotalConsumption(double amount)
           
protected  void readjustMeter()
          Allows internal realignment to new metering situations that need an immediate utilization reading
 boolean startMeter(long interval, boolean dropPriorReading)
          Initiates an energy metering session.
 void stopMeter()
          Terminates the metering session, the totalconsumption values will no longer be updated!
 
Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.Timed
compareTo, fire, getFireCount, getFrequency, getNextEvent, getNextFire, isSubscribed, jumpTime, nextEventDistance, resetTimed, setBackPreference, simulateUntil, simulateUntilLastEvent, skipEventsTill, subscribe, tick, toString, unsubscribe, updateFrequency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

totalConsumption

private double totalConsumption

meteringStarted

private long meteringStarted

lastMetered

protected long lastMetered

meteringStopped

private long meteringStopped
Constructor Detail

EnergyMeter

public EnergyMeter()
Method Detail

startMeter

public boolean startMeter(long interval,
                          boolean dropPriorReading)
Initiates an energy metering session.

Parameters:
interval - The meter refresh frequency.
dropPriorReading -
    False: the totalConsumption values will accumulate from a previous metering session True: the totalconsumption values will start from 0 after the completion of this function.
Returns:
  • False: if a metering session is already underway
  • True: if the metering session was successfully initiated

stopMeter

public void stopMeter()
Terminates the metering session, the totalconsumption values will no longer be updated!


getTotalConsumption

public double getTotalConsumption()
Allows the reading of the meter's current consumption report.

Returns:

getMeteringStarted

public long getMeteringStarted()
Allows the reading of the beginning time instance of the metering session If there were several metering sessions done by this meter, then this function reports the time instance when a hypothetical single continuous metering session would have started

Returns:
The time instance when the metering session started

getMeteringStopped

public long getMeteringStopped()
Enables access to the time when the last reading was stored for the last stopped metering session.

Returns:
Three values are possible:
  • -1: The metering session is ongoing it is not yet terminated
  • 0: There was no metering session so far with this meter
  • arbitrary positive number: The last reading time of the last stopped session.

increaseTotalConsumption

protected void increaseTotalConsumption(double amount)

readjustMeter

protected void readjustMeter()
Allows internal realignment to new metering situations that need an immediate utilization reading



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