Diversification and localization of energy systems for sustainable development and energy security