Optimal design of hybrid renewable energy systems