Operating and Planning Electricity Grids With Variable Renewable Generation