Optimized Energy Control In Power Distribution Systems