Added first version of algorithm calculating energy consumption.