A system for controlling power distribution between a renewable energy source (RES) that generates electrical power, a power grid, an energy storage system (ESS) coupled to and configured to store electrical power from the RES and the power grid, and a behind-the-meter (BTM) load coupled to and…