Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.sim
Class Energy

    java.lang.Object
      avrora.sim.Energy

public class Energy
extends java.lang.Object

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[] modeAmphere, java.lang.String[] modeName, int cpuFreq, int startMode, EnergyControl ec, State st)` create new energy class, to enable energy modelling

Method Summary
`double` | `getConsumedEnergy(int mode)` get the power consumption of a state
`double` | `getCurrentAmphere()` 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` | `getModeAmphere(int mode)` get the current draw of a mode
`java.lang.String` | `getModeName(int mode)` get the name of a mode
`java.lang.String[]` | `getModeNames()` get the names of all modes
`int` | `getModeNumber()` get the number of modes of this device
`java.lang.String` | `getName()` get the device name
`double` | `getOldAmphere()` get the current draw of the old mode
`int` | `getOldMode()` get old mode
`double` | `getTotalConsumedEnergy()` get the power consumption of this device
`void` | `setMode(int mode)` set the current mode or state of the device

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Energy

    public Energy(java.lang.String deviceName,
                  double[] modeAmphere,
                  java.lang.String[] modeName,
                  int cpuFreq,
                  int startMode,
                  EnergyControl ec,
                  State st)

  create new energy class, to enable energy modelling

Parameters:
  `deviceName` - name of the device to model
  `modeAmphere` - array of current draw for each device state (in Amphere)
  `modeName` - array of the names of each device state
  `cpuFreq` - cpu frequency
  `startMode` - mode or state of the device at startup and reset
  `ec` - the simulator energy control
  `st` - the simulator state

Method Detail

### setMode

    public void setMode(int mode)

  set the current mode or state of the device

  Parameters:
    `mode` - mode numer to set

### getTotalConsumedEnergy

    public double getTotalConsumedEnergy()

  get the power consumption of this device

  Returns:
    power consumption in Joule

### getConsumedEnergy

    public double getConsumedEnergy(int mode)

  get the power consumption of a state

  Parameters:
    `mode` - the mode or state
  Returns:
    power consumption in Joule

### getModeNumber

    public int getModeNumber()

  get the number of modes of this device

  Returns:
    mode number

### getCurrentMode

    public int getCurrentMode()

  get the current state or mode of the device

  Returns:
    current mode

### getModeName

    public java.lang.String getModeName(int mode)

  get the name of a mode

  Parameters:
    `mode` - mode number
  Returns:
    mode name

### getModeAmphere

    public double getModeAmphere(int mode)

  get the current draw of a mode

  Parameters:
    `mode` - mode number
  Returns:
    current draw in Amphere

### getCycles

    public long getCycles(int mode)

  get the cycles spend in a device state

  Parameters:
    `mode` - mode number
  Returns:
    cycles

### getName

    public java.lang.String getName()

  get the device name

  Returns:
    device name

### getModeNames

    public java.lang.String[] getModeNames()

  get the names of all modes

  Returns:
    array with all mode names

### getOldMode

    public int getOldMode()

  get old mode

  Returns:
    old mode

### getCurrentAmphere

    public double getCurrentAmphere()

  get the current draw

  Returns:
    current draw in Amphere

### getOldAmphere

    public double getOldAmphere()

  get the current draw of the old mode

  Returns:
    current draw

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD