intelligent-environments-lab / CityLearn

Official reinforcement learning environment for demand response and load shaping
MIT License
462 stars 167 forks source link

Battery degradation causing soc > 1.0 #29

Closed kingsleynweye closed 1 year ago

kingsleynweye commented 1 year ago

When the battery is already 100%, the capacity at the next time step will be less than the capacity at which it reached 100% because of degradation at previous time step. So, the normalized soc > 1.0. When calculating the max input/output power from the power curve at normalized soc > 1.0, it outputs the value as if soc << 1.0 (maximum output). This will be the case until the soc loss as a result of the loss coefficient brings the soc below the degraded capacity which will happen in a few of time steps.

Most obvious with a random action agent but an intelligent agent could learn the behavior overtime and just avoid sending large discharge actions when soc == 1.0

To fix the bug, make sure this line always evaluates 0.0 <= normalized_soc <= 1.0

kingsleynweye commented 1 year ago

Fixed with this commit: https://github.com/intelligent-environments-lab/CityLearn/commit/c65425d3f74822791f262fa0c47d722f4c5bfa55 in v1.4.0.