Researchers have developed a new way of managing electricity supplies that could help keep power grids stable as they become more dependent on wind and solar energy.