| Applicable Versions | Netsim Standard | Netsim Pro |
| Applicable Releases | v11 | v12 | v13 |
Energy consumption is calculated individually for each sensor node that is part of the network scenario during various Radio States such as SLEEP, TRX_ON_BUSY, RX_ON_IDLE, RX_ON_BUSY, RX_OFF.
Based on the calculations done, NetSim provides a detailed Battery Model Metrics table that provides energy consumption of each device with respect to Transmission, Reception, Idle Mode, Sleep Mode, etc.
It also provides information about the node's initial energy, consumed energy and remaining energy. However, remaining energy may also include harvested energy if energy harvesting is turned on.
declspec(dllexport) void battery_metrics(PMETRICSWRITER metricsWriter)
{
ptrBATTERY b;
static bool isCalled = false;
if (isCalled)
return;
isCalled = true;
if (!firstBattery)
return; // No battery is added
PMETRICSNODE menu = init_metrics_node(MetricsNode_Menu, "Battery model", NULL);
PMETRICSNODE table = init_metrics_node(MetricsNode_Table, "Battery model", NULL);
add_node_to_menu(menu, table);
char modeList[BUFSIZ]="";
sprintf(modeList, "Device Name#1,Initial energy(mJ)#1,Consumed energy(mJ)#1,Remaining Energy(mJ)#1,Recharging Energy(mJ)#1,");
prepare_mode_list(modeList);
add_table_heading_special(table, modeList);
b = firstBattery;
while (b)
.
.
.
.

The default settings in the energy model in NetSim IoT/ WSN library is based on Table 1 in the following paper: