Integrating Renewable Energy into the Electricity Grid