|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.energy.Energy
Class for energy modeling. All consumers create an instance of this class and keep it updated with all state changes concerning power consumption. This class keeps track of all these state changes and cycles spend in each state. The state changes are propagated to monitors based on a subscription system. This enables logging of power consumption.
Constructor Summary | |
Energy(java.lang.String deviceName,
double[] modeAmpere,
FiniteStateMachine fsm)
create new energy class, to enable energy modelling |
Method Summary | |
void |
activate()
active energy modeling, e.g. insert the probe into to component state machine |
void |
fireAfterTransition(int beforeState,
int afterState)
The fireAfterTransition() method allows the probe to gain control
after the state machine transitions between two states. |
void |
fireBeforeTransition(int beforeState,
int afterState)
The fireBeforeTransition() method allows the probe to gain control
before the state machine transitions between two states. |
double |
getConsumedEnergy(int mode)
get the power consumption of a state |
double |
getCurrentAmpere()
get the current draw |
int |
getCurrentMode()
get the current state or mode of the device |
long |
getCycles(int mode)
get the cycles spend in a device state |
double |
getModeAmpere(int mode)
get the current draw of a mode |
java.lang.String |
getModeName(int mode)
get the name of a mode |
int |
getModeNumber()
get the number of modes of this device |
java.lang.String |
getName()
get the device name |
double |
getOldAmpere()
get the current draw of the old mode |
int |
getOldMode()
get old mode |
double |
getTotalConsumedEnergy()
get the power consumption of this device |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Energy(java.lang.String deviceName, double[] modeAmpere, FiniteStateMachine fsm)
deviceName
- name of the device to modelmodeAmpere
- array of current draw for each device state (in Ampere)fsm
- finite state machine of this deviceMethod Detail |
public void fireBeforeTransition(int beforeState, int afterState)
fireBeforeTransition()
method allows the probe to gain control
before the state machine transitions between two states. The before state and the
after state are passed as parameters.
fireBeforeTransition
in interface FiniteStateMachine.Probe
beforeState
- the before state represented as an integerafterState
- the after state represented as an integerpublic void fireAfterTransition(int beforeState, int afterState)
fireAfterTransition()
method allows the probe to gain control
after the state machine transitions between two states. The before state and the
after state are passed as parameters.
fireAfterTransition
in interface FiniteStateMachine.Probe
beforeState
- the before state represented as an integerafterState
- the after state represented as an integerpublic double getTotalConsumedEnergy()
public double getConsumedEnergy(int mode)
mode
- the mode or state
public int getModeNumber()
public int getCurrentMode()
public java.lang.String getModeName(int mode)
mode
- mode number
public double getModeAmpere(int mode)
mode
- mode number
public long getCycles(int mode)
mode
- mode number
public java.lang.String getName()
public int getOldMode()
public double getCurrentAmpere()
public double getOldAmpere()
public void activate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |