Calculating Energy Used by Devices