Skip to main content
The code below describes an application to manage the state of charge of a battery system. It continuously checks the battery’s SOC and adjusts the power setpoint to charge or discharge the battery towards a target SOC, constrained by predefined minimum and maximum SOC levels. The power setpoint is limited by the maximum import/export capabilities of the converter and the charge/discharge limits of the battery. Commands are then sent to the converter to adjust its power output accordingly. The script runs in an infinite loop with a specified delay between each iteration, and it handles exceptions and graceful shutdown on user interruption.
target-soc.py