Energy storage control calculation problem