Difference between revisions of "Energy model"

From Nsnam
Jump to: navigation, search
(References)
 
(47 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
= General =
 +
 +
[http://www.ee.washington.edu/research/nsl/faculty/radha/ Network Security Lab (NSL)], University of Washington, Seattle has begun work on an generic energy model for ns3. The goal is to simulate an energy source and keep track of energy consumptions of various devices in the node. Current version focuses on radio energy consumption.
 +
 
= Background =
 
= Background =
  
Energy modeling is a key element in wireless network simulation. Energy consumption is an important benchmark for network protocols. Many intelligent protocols are energy aware and to simulate such protocols, a energy model is required. A energy model has been implemented in ns2 ([http://www.isi.edu/nsnam/ns/doc/node224.html ns2 energy model]) but is yet to be implemented in ns3.
+
Energy modeling is a key element in wireless network simulation. In several simulation scenarios, the energy consumption at a particular node, or at a particular component of a node, is of interest. Further, energy consumption is an important metric for evaluating the performance of wireless network protocols. Also, if a protocol is energy-aware, i.e. its operation depends on the energy level, it cannot be effectively simulated without an energy model. An energy model has been implemented in ns2 ([http://www.isi.edu/nsnam/ns/doc/node224.html ns2 energy model]) but is yet to be implemented in ns3.
  
 
= Project Goals =
 
= Project Goals =
  
[http://www.ee.washington.edu/research/nsl/faculty/radha/ Network Security Lab], University of Washington, Seattle has begun work on an generic energy model for ns3. We hope to provide the basic structures for modeling energy sources and energy consumption of various devices on the node. To enable recording of energy consumption for individual (radio) devices and network protocols. The energy model will provide the following components:
+
In this project, we aim to provide the basic structures for modeling energy sources and energy consumption of various devices on the node. The energy source class will enable the modeling of batteries, discharging models, etc. while the energy consumption models are used to represent the energy consumed by various components of a node. The energy model will provide the following components:
 
*Energy source model.
 
*Energy source model.
 
**Battery.
 
**Battery.
 
**etc.
 
**etc.
*Device energy model.
+
*Device energy consumption model.
 
**Radio.
 
**Radio.
 
**etc.
 
**etc.
 +
 +
= Schedule =
 +
 +
*03/24/2011 : Paper "An Energy Framework for the Network Simulator 3 (ns-3)" presentation at the [http://www.simutools.org/2011/Programme/Schedule SIMUTOOLS 2011] conference.
 +
*01/13/2011 : Paper "An Energy Framework for the Network Simulator 3 (ns-3)" accepted by the [http://www.simutools.org/2011/ SIMUTOOLS 2011] conference.
 +
*01/05/2011 : Code update released with ns-3.10 in src/contrib/energy
 +
*08/20/2010 - 01/04/2011: Public review. Code available at: http://codereview.appspot.com/1008043/show
 +
*08/20/2010 : Released with ns-3.9 in src/contrib/energy.
 +
*04/19/2010 - 4/23/2010: Private review of radio energy model.
  
 
= Energy Model Hierarchy =
 
= Energy Model Hierarchy =
Line 21: Line 34:
 
*Device energy model.
 
*Device energy model.
  
Only a single energy source will exist on a node, representing the total energy reserve at the node. Multiple device energy model can exist on a single node, representing different devices. The device energy model will update the remaining energy at the energy source. When energy is depleted, the energy source will notify all device energy models.
+
Only a single energy source will exist on a node, representing the total energy reserve at the node. Multiple device energy models can exist on a single node, representing different devices. Each device energy model will notify the energy source of the energy consumed by that device, and thus update the remaining energy of the source. When energy is completely drained, the energy source will notify all device energy models connected to it.
  
 
== Energy Source ==
 
== Energy Source ==
  
[[File:Ns-3_energy_source.PNG|thumb|Energy source class structure]]
+
[[File:Ns-3_energy_source.PNG|thumb|Energy source class structure. Classes in dotted boxes are not included in initial release.]]
  
Child of the energy source class implements a specific type of energy source, eg. a battery. This base class provides interfaces for different energy model to update/record total energy consumption on the node. Some typical child classes:
+
This is an abstract base class that provides interfaces for for updating/recording total energy consumption on the node. It also issues a notification when the remaining energy goes to zero.
 +
 
 +
Child classes of the energy source class implement a specific type of energy source, eg. a battery. Some typical child classes are:
 
*Basic energy source.
 
*Basic energy source.
**Provides basic energy source functionalities such as keeping track of remaining energy, decrease remaining energy, notify device energy models for energy depletion.
+
**Provides basic functionalities such as keeping track of remaining energy, decrease remaining energy, notify device energy models on complete depletion of energy.
*Battery energy source.
+
*Rakhmatov-Vrudhula non-linear battery model.
**Sub class that models behavior of a battery.
+
**Non-linear battery model capable of capturing Rate Capacity Effect and Recovery Effect.
  
 
== Device Energy Model ==
 
== Device Energy Model ==
  
[[File:Ns-3_device_energy_model.PNG|thumb|Device energy model]]
+
[[File:Ns-3_device_energy_model.PNG|thumb|Device energy model class structure. Classes in dotted boxes are not included in initial release.]]
  
Child of the device energy model class implements energy consumption schemes of a specific device, eg. a radio device. This class provides interfaces for updating remaining energy in the energy source and handles notifications form the energy source when node energy is depleted. It can also records the total energy consumption of the device. Note that multiple device energy model can exist on the same node.
+
This is a base class and its main function is to monitor the state of a device, and accordingly calculate its energy consumption. It provides interfaces for updating remaining energy in the energy source and handles the notification from the energy source when node energy is depleted. It also maintains a record of the total energy consumption of the device.
 +
 
 +
Child classes of the device energy consumption class implement energy consumption schemes of specific devices, eg. a radio device. Multiple device models can exist on a node, representing energy consumption due to its different components. Further, multiple objects of the same device model class can also be used in a node. eg. a node could have multiple radios, and hence will have multiple radio energy consumption models.
  
 
A typical child implementation of this class is the radio energy model class.
 
A typical child implementation of this class is the radio energy model class.
  
=== Radio Energy Model ===
+
=== Wifi Radio Energy Model ===
  
This class represents energy model for radio devices. It is a base class for implementing other radio energy models. The radio energy model defines the typical operating states of a radio:
+
This class represents energy model for Wifi radio devices with states:
*Idle
+
*IDLE
*Tx
+
*CCA_BUSY
*Rx
+
*TX
*Sleep
+
*RX
 +
*SWITCHING
 +
*OFF
  
Behaviors of switching between different modes are implemented by radio energy model's child class. Note that multiple radio energy model can exist on the same node.
+
These states are defined in the WifiPhy class of ns-3.
  
 
= Usage =
 
= Usage =
  
= Schedule =
+
The following code snippet installs an energy source (BasicEnergySource) and a WifiRadioEnergyModel onto each node.
 +
 
 +
  /* create some nodes */
 +
  NodeContainer c;
 +
  c.Create(5);
 +
 
 +
  /* energy source */
 +
  BasicEnergySourceHelper basicSourceHelper;
 +
  // configure energy source
 +
  basicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (0.1));
 +
  // install source
 +
  EnergySourceContainer sources = basicSourceHelper.Install (c);
 +
  /* device energy model */
 +
  WifiRadioEnergyModelHelper radioEnergyHelper;
 +
  // configure radio energy model
 +
  radioEnergyHelper.Set ("TxCurrentA", DoubleValue (0.0174));
 +
  // install device model
 +
  DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);
 +
 
 +
The WifiRadioEnergyModel class fully supports the ns-3 built-in WiFi PHY class (YansWifiPhy). A sample simulation script of using the energy model is available in the "examples/energy" folder of ns-3.10.
 +
 
 +
= Expending the Energy Model =
 +
 
 +
Initial release of the energy model only includes implementations of a basic energy source and a basic radio energy model. However, developers can use the interfaces provided to model a wide variety of energy sources and devices.
 +
 
 +
== Energy Source ==
 +
 
 +
=== Public APIs ===
 +
 
 +
The energy source base class provides the following interfaces:
 +
 
 +
* '''GetSupplyVoltage:'''
 +
** Returns the supply voltage of the energy source.
 +
** Must be implemented by child classes.
 +
 
 +
* '''GetInitialEnergy:'''
 +
** Returns the initial energy (capacity) stored in the energy source.
 +
** The initial energy (capacity) of a energy source is specific to each implementation. Therefore we do not enforce a "SetInitialEnergy" interface in the base class.
 +
 
 +
* '''GetRemainingEnergy:'''
 +
** Returns the remaining energy stored in the energy source.
 +
 
 +
* '''GetEnergyFraction:'''
 +
** Returns the energy fraction [0,1] at the energy source. Energy fraction is defined as (remaining energy) / (initial energy).
 +
 
 +
* '''UpdateEnergySource:'''
 +
** Notifies EnergySource of stage changes in DeviceEnergyModels. Typically called by DeviceEnergyModels to inform EnergySource of a state change.
 +
** This interface is used to implement non-linear energy update.
 +
 
 +
* '''SetNode:'''
 +
** Sets reference (pointer) to node where EnergySource is installed on.
 +
 
 +
* '''GetNode:'''
 +
** Returns reference (pointer) to node where EnergySource is installed on.
 +
 
 +
* '''AppendDeviceEnergyModel:'''
 +
** Called when installing device energy models. Energy source object keeps track of every device energy models installed onto the node.
 +
 
 +
* '''FindDeviceEnergyModels:'''
 +
** Returns a DeviceEnergyModelContainer containing a list of device energy models installed on the node. Useful when one wants to query certain types of devices for it energy consumption.
 +
 
 +
=== Protected APIs ===
 +
 
 +
* '''CalculateTotalCurrent:'''
 +
** Returns total current draw from all DeviceEnergyModel objects.
 +
 
 +
* '''NotifyEnergyDrained''':
 +
** This function Notifies all DeviceEnergyModels installed on the node for the energy depletion event.
 +
** It should be called when energy is drained (remaining energy = 0) in the energy source.
 +
 
 +
* '''BreakDeviceEnergyModelRefCycle''':
 +
** This function breaks the reference cycle between EnergySource and the list of DeviceEnergyModels.
 +
** It should be called in DoDispose by all derived class of EnergySource.
 +
 
 +
=== Examples ===
 +
 
 +
Please see the BasicEnergySource class implementation for how the interfaces are used.
 +
 
 +
== Device Energy Model ==
 +
 
 +
=== Public APIs ===
 +
 
 +
The device energy model base class provides the following interfaces:
 +
 
 +
* '''SetEnergySource''':
 +
** Called when installing device energy models. A device energy model can not operate without an energy source.
 +
 
 +
* '''GetTotalEnergyConsumption:'''
 +
** Returns total energy consumed by the device.
 +
 
 +
* '''ChangeState:'''
 +
** Notifies DeviceEnergyModel of a state change.
 +
** Input parameter can be the state number or a value used internally by the DeviceEnergyModel.
 +
 
 +
* '''GetCurretA:'''
 +
** Returns the current draw, in Ampere of the DeviceEnergyModel, at its current state.
 +
 
 +
* '''HandleEnergyDepletion''':
 +
** Automatically called by the energy source object when energy is depleted. It's implementation is specific for each device.
 +
 
 +
=== Examples ===
 +
 
 +
Please see the WifiRadioEnergySource class implementation for how the interfaces are used.
  
*4/19/2010 - 4/23/2010: Private review of radio energy model.
+
[[Category:Models]]

Latest revision as of 08:30, 26 May 2018

General

Network Security Lab (NSL), University of Washington, Seattle has begun work on an generic energy model for ns3. The goal is to simulate an energy source and keep track of energy consumptions of various devices in the node. Current version focuses on radio energy consumption.

Background

Energy modeling is a key element in wireless network simulation. In several simulation scenarios, the energy consumption at a particular node, or at a particular component of a node, is of interest. Further, energy consumption is an important metric for evaluating the performance of wireless network protocols. Also, if a protocol is energy-aware, i.e. its operation depends on the energy level, it cannot be effectively simulated without an energy model. An energy model has been implemented in ns2 (ns2 energy model) but is yet to be implemented in ns3.

Project Goals

In this project, we aim to provide the basic structures for modeling energy sources and energy consumption of various devices on the node. The energy source class will enable the modeling of batteries, discharging models, etc. while the energy consumption models are used to represent the energy consumed by various components of a node. The energy model will provide the following components:

  • Energy source model.
    • Battery.
    • etc.
  • Device energy consumption model.
    • Radio.
    • etc.

Schedule

  • 03/24/2011 : Paper "An Energy Framework for the Network Simulator 3 (ns-3)" presentation at the SIMUTOOLS 2011 conference.
  • 01/13/2011 : Paper "An Energy Framework for the Network Simulator 3 (ns-3)" accepted by the SIMUTOOLS 2011 conference.
  • 01/05/2011 : Code update released with ns-3.10 in src/contrib/energy
  • 08/20/2010 - 01/04/2011: Public review. Code available at: http://codereview.appspot.com/1008043/show
  • 08/20/2010 : Released with ns-3.9 in src/contrib/energy.
  • 04/19/2010 - 4/23/2010: Private review of radio energy model.

Energy Model Hierarchy

Energy model information flow

The energy model consists of 2 major components:

  • Energy source.
  • Device energy model.

Only a single energy source will exist on a node, representing the total energy reserve at the node. Multiple device energy models can exist on a single node, representing different devices. Each device energy model will notify the energy source of the energy consumed by that device, and thus update the remaining energy of the source. When energy is completely drained, the energy source will notify all device energy models connected to it.

Energy Source

Energy source class structure. Classes in dotted boxes are not included in initial release.

This is an abstract base class that provides interfaces for for updating/recording total energy consumption on the node. It also issues a notification when the remaining energy goes to zero.

Child classes of the energy source class implement a specific type of energy source, eg. a battery. Some typical child classes are:

  • Basic energy source.
    • Provides basic functionalities such as keeping track of remaining energy, decrease remaining energy, notify device energy models on complete depletion of energy.
  • Rakhmatov-Vrudhula non-linear battery model.
    • Non-linear battery model capable of capturing Rate Capacity Effect and Recovery Effect.

Device Energy Model

Device energy model class structure. Classes in dotted boxes are not included in initial release.

This is a base class and its main function is to monitor the state of a device, and accordingly calculate its energy consumption. It provides interfaces for updating remaining energy in the energy source and handles the notification from the energy source when node energy is depleted. It also maintains a record of the total energy consumption of the device.

Child classes of the device energy consumption class implement energy consumption schemes of specific devices, eg. a radio device. Multiple device models can exist on a node, representing energy consumption due to its different components. Further, multiple objects of the same device model class can also be used in a node. eg. a node could have multiple radios, and hence will have multiple radio energy consumption models.

A typical child implementation of this class is the radio energy model class.

Wifi Radio Energy Model

This class represents energy model for Wifi radio devices with states:

  • IDLE
  • CCA_BUSY
  • TX
  • RX
  • SWITCHING
  • OFF

These states are defined in the WifiPhy class of ns-3.

Usage

The following code snippet installs an energy source (BasicEnergySource) and a WifiRadioEnergyModel onto each node.

 /* create some nodes */ 
 NodeContainer c;
 c.Create(5);
 
 /* energy source */
 BasicEnergySourceHelper basicSourceHelper;
 // configure energy source
 basicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (0.1));
 // install source
 EnergySourceContainer sources = basicSourceHelper.Install (c);
 /* device energy model */
 WifiRadioEnergyModelHelper radioEnergyHelper;
 // configure radio energy model
 radioEnergyHelper.Set ("TxCurrentA", DoubleValue (0.0174));
 // install device model
 DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);

The WifiRadioEnergyModel class fully supports the ns-3 built-in WiFi PHY class (YansWifiPhy). A sample simulation script of using the energy model is available in the "examples/energy" folder of ns-3.10.

Expending the Energy Model

Initial release of the energy model only includes implementations of a basic energy source and a basic radio energy model. However, developers can use the interfaces provided to model a wide variety of energy sources and devices.

Energy Source

Public APIs

The energy source base class provides the following interfaces:

  • GetSupplyVoltage:
    • Returns the supply voltage of the energy source.
    • Must be implemented by child classes.
  • GetInitialEnergy:
    • Returns the initial energy (capacity) stored in the energy source.
    • The initial energy (capacity) of a energy source is specific to each implementation. Therefore we do not enforce a "SetInitialEnergy" interface in the base class.
  • GetRemainingEnergy:
    • Returns the remaining energy stored in the energy source.
  • GetEnergyFraction:
    • Returns the energy fraction [0,1] at the energy source. Energy fraction is defined as (remaining energy) / (initial energy).
  • UpdateEnergySource:
    • Notifies EnergySource of stage changes in DeviceEnergyModels. Typically called by DeviceEnergyModels to inform EnergySource of a state change.
    • This interface is used to implement non-linear energy update.
  • SetNode:
    • Sets reference (pointer) to node where EnergySource is installed on.
  • GetNode:
    • Returns reference (pointer) to node where EnergySource is installed on.
  • AppendDeviceEnergyModel:
    • Called when installing device energy models. Energy source object keeps track of every device energy models installed onto the node.
  • FindDeviceEnergyModels:
    • Returns a DeviceEnergyModelContainer containing a list of device energy models installed on the node. Useful when one wants to query certain types of devices for it energy consumption.

Protected APIs

  • CalculateTotalCurrent:
    • Returns total current draw from all DeviceEnergyModel objects.
  • NotifyEnergyDrained:
    • This function Notifies all DeviceEnergyModels installed on the node for the energy depletion event.
    • It should be called when energy is drained (remaining energy = 0) in the energy source.
  • BreakDeviceEnergyModelRefCycle:
    • This function breaks the reference cycle between EnergySource and the list of DeviceEnergyModels.
    • It should be called in DoDispose by all derived class of EnergySource.

Examples

Please see the BasicEnergySource class implementation for how the interfaces are used.

Device Energy Model

Public APIs

The device energy model base class provides the following interfaces:

  • SetEnergySource:
    • Called when installing device energy models. A device energy model can not operate without an energy source.
  • GetTotalEnergyConsumption:
    • Returns total energy consumed by the device.
  • ChangeState:
    • Notifies DeviceEnergyModel of a state change.
    • Input parameter can be the state number or a value used internally by the DeviceEnergyModel.
  • GetCurretA:
    • Returns the current draw, in Ampere of the DeviceEnergyModel, at its current state.
  • HandleEnergyDepletion:
    • Automatically called by the energy source object when energy is depleted. It's implementation is specific for each device.

Examples

Please see the WifiRadioEnergySource class implementation for how the interfaces are used.