Given the constantly raising world-wide energy demand and the accompanying increase in greenhouse gas emissions that pushes the progression of climate change, the possibly most important task in future is to find a carbon-low energy supply that finds the right balance between sustainability and energy security. For renewable energy generation, however, especially the second aspect turns out to be difficult as the supply of renewable sources underlies strong volatility. Further on, investment costs for new technologies are so high that competitiveness with conventional energy forms is hard to achieve. To address this issue, we analyze in this paper a non-autonomous optimal control model considering the optimal composition of a portfolio that consists of fossil and renewable energy and which is used to cover the energy demand of a small country. While fossil energy is assumed to be constantly available, the supply of the renewable resource fluctuates seasonally. We further on include learning effects for the renewable energy technology, which will underline the importance of considering the whole life span of such a technology for long-term energy planning decisions.