Plotting Overall Energy Consumption in the Sensor Devices:
At the end of any network simulation in WSN/IoT networks in NetSim, a detailed Energy Consumption Metrics is provided as part of the Results Window as shown below:
Battery Model Metrics Table:

The columns Device Name and Consumed Energy(mJ) will be useful to obtain plots to compare the overall energy consumption between devices for the simulation performed.Please follow the steps given below to get Energy consumed by each node with respect to simulation time.

This will export all the metrics tables that are part of the Simulation Results window to a comma separated csv file as shown below:


Plotting Individual Energy Consumption in the Sensor Devices:
If Packet animation is enabled, NetSim logs the energy consumption of individual sensors in a text file, which can be used for the purpose of plotting the energy consumption individually. Follow the steps given below to quickly obtain energy consumption plots for any sensor in WSN/IoT network:
If the Energy consumption of Node 1 is to be plotted with respect to simulation time, follow the steps given below:



Note that the Animation_<Node name>_BatteryPower.txt log file contains the percentage of energy present in the sensors and this should not be considered as the actual value of remaining energy present in the sensors. The actual value of the remaining energy is available in the Battery Model Metrics present in the NetSim Simulation Results window.
The default settings in the energy model in NetSim IoT/ WSN library is based on Table 1 in the following paper:
Accurate Prediction of Power Consumption in Sensor Networks
Related articles:
where-is-energy-consumption-battery-model-in-netsim-wsn-iot-set-calculated-