Abstract Production facilities that store solar or wind energy in the form of chemicals present underused capacity. The problem needs to address uncertain and variable operating conditions and prices for complex process models. An MILP formulation is developed including surrogate models based on the detailed NLP steady state models. The model solves the tradeoffs between investment and production capacity. This approach is applied to the case of the production of methanol from CO2 and solar or wind based hydrogen. Two cases are evaluated, Spain and UK. For the Spanish case, if electricity can be sold and there is no area restrictions, the process produces an excess of electricity with the solar panels available during summer time. Otherwise, electricity is only produced when excess capacity is available. In the UK, only wind turbines are used and the excess of electricity is produced during winter time.