ENERGY STORAGE CABINET ALGORITHM