Optimization of Rural Electrification Systems with Renewable Energies and Micro-Networks