The energy balance calculation of battery discharge seems to be mistaken

as this example shows, the amount of discharged energy given by citylearn is the quotient, instead of the product, of the difference between consecutive SOCs and efficiency

1 Like

@james_cheng8 - In case you are still looking at this, I was confused by this as well but I think it’s correct.

The definition of discharging is in the docs here.


It looks like the battery will discharge more than the energy it is providing the building.

Row 4 is where I discharged the battery by 50%. The battery electricity consumption seems to be basically 1/2 of of the storage capacity. But the soc decreased by ~3.4 which is higher than the energy the battery is providing


I looked up the code responsible for this in It looks like when the energy is stored, it is multiplied by the efficiency factor. In other words, the energy stored is less than the energy directed towards the battery.

When it’s discharged, it’s divided by the efficiency factor. This means the energy in the battery decreases by more than the energy discharged.

I think this means the efficiency penalty is paid twice; once upon charge and once upon discharge.

Hi @james_cheng8 and thanks for your observation. There was a bug fix and new release, v1.3.5 that fixed this bug.