When Hurricane Sandy hit New York City last and knocked out the power, many buildings were able to keep their lights running thanks to microgrids that used renewable sources of energy, generated onsite rather than derived from the larger electrical grid.