Empowering Distributed Solutions in Renewable Energy Systems and Grid Optimization