[#9] Made common energy calculation function.

Reduced duplication by consolodating all energy calculations that are in the same voltage/frequency domain.