# Modeling Power Consumption¶

## Overview¶

Modeling power consumption becomes more and more important with the increasing number of embedded devices and the upcoming Internet of Things. Mobile personal medical devices, large scale wireless environment monitoring devices, electric vehicles, solar panels, low-power wireless sensors, etc. require paying special attention to power consumption. High-fidelity simulation of power consumption allows designing power-sensitive routing protocols, MAC protocols with power management features, etc., which in turn results in more energy efficient devices.

In order to help the modeling process, the INET power model is separated from other simulation models. This separation makes the power model extensible, and it also allows easy experimentation with alternative implementations. In a nutshell, the power model consists of the following components:

• energy consumption models

• energy generation models

• temporary energy storage models

The power model elements fall into two categories, abbreviated with Ep and Cc as part of their names:

• Ep models are simpler, and deal with energy and power quantities.

• Cc models are more realistic, and deal with charge, current, and voltage quantities.

The following sections provide a brief overview of the power model.

## Energy Consumer Models¶

Energy consumer models describe the energy consumption of devices over time. For example, a transceiver consumes energy when it transmits or receives a signal, a CPU consumes energy when the network protocol forwards a packet, and a display consumes energy when it is turned on.

In INET, an energy consumer model is an OMNeT++ simple module that implements the energy consumption of software processes or hardware devices over time. Its main purpose is to provide the power or current consumption for the current simulation time. Most often energy consumers are included as submodules in the compound module of the hardware devices or software components.

INET provides only a few built-in energy consumer models:

In order to simulate power consumption in a wireless network, the energy consumer model type must be configured for the transceivers. The following example demonstrates how to configure the power consumption parameters for a transceiver energy consumer model:

*.host[*].wlan[*].radio.energyConsumer.typename = "StateBasedEpEnergyConsumer"
transmitterTransmittingPowerConsumption = 100mW # continue previous line


## Energy Generator Models¶

Energy generator models describe the energy generation of devices over time. A solar panel, for example, produces energy based on time, the panel’s location on the globe, its orientation towards the sun and the actual weather conditions. Energy generators connect to an energy storage that absorbs the generated energy.

In INET, an energy generator model is an OMNeT++ simple module implementing the energy generation of a hardware device using a physical phenomena over time. Its main purpose is to provide the power or current generation for the current simulation time. Most often energy generation models are included as submodules in network nodes.

INET provides only one trivial energy/power based statistical energy generator model called AlternatingEpEnergyGenerator. The following example shows how to configure its power generation parameters:

*.host[*].energyGenerator.typename = "AlternatingEpEnergyGenerator"
*.host[*].energyGenerator.energySinkModule = "^.energyStorage" # module ref.
*.host[*].energyGenerator.powerGeneration = 1mW
*.host[*].energyGenerator.sleepInterval = exponential(10s) # random intervals
*.host[*].energyGenerator.generationInterval = exponential(10s)


## Energy Storage Models¶

Electronic devices which are not connected to external power source must contain some component to store energy. For example, an electrochemical battery in a mobile phone provides energy for its display, its CPU, and its communication devices. It might also absorb energy produced by a solar installed on its display, or by a portable charger plugged into the wall socket.

In INET, an energy storage model is an OMNeT++ simple module which models the physical phenomena that is used to store energy produced by generators and provide energy for consumers. Its main purpose is to compute the amount of available energy or charge at the current simulation time. It maintains a set of connected energy consumers and energy generators, their respective total power consumption and total power generation.

INET contains a few built-in energy storage models:

• IdealEpEnergyStorage is an idealistic model with infinite energy capacity and infinite power flow.

• SimpleEpEnergyStorage is a non-trivial model integrating the difference between the total consumed power and the total generated power over time.

• SimpleCcBattery is a more realistic charge/current based battery model using a charge independent ideal voltage source and internal resistance.

The following example shows how to configure a simple energy storage model:

*.host[*].energyStorage.typename = "SimpleEpEnergyStorage"
*.host[*].energyStorage.nominalCapacity = 0.05J # maximum capacity
*.host[*].energyStorage.initialCapacity = uniform(0J, this.nominalCapacity)


## Energy Management Models¶

SimpleEpEnergyManagement

*.host[*].energyManagement.typename = "SimpleEpEnergyManagement"
*.host[*].energyManagement.nodeStartCapacity = 0.025J # start threshold
*.host[*].energyManagement.nodeShutdownCapacity = 0J # shutdown threshold