Battery energy system calculation