In a sprawling complex of laboratories and futuristic gadgets in Golden, Colo., a supercomputer named Peregrine does a quadrillion calculations per second to help scientists figure out how to keep the lights on.
Peregrine was turned on this year by the U.S. Energy Department. It has the world's largest "petascale" computing capability. It is the size of a Mack truck.
Its job is to figure out how to cope with a risk from something the public generally thinks of as benign — renewable energy.
Energy officials worry a lot these days about the stability of the massive patchwork of wires, substations and algorithms that keeps electricity flowing. They rattle off several scenarios that could lead to a collapse of the power grid — a well-executed cyberattack, a freak storm, sabotage.
But as states, led by California, race to bring more wind, solar and geothermal power online, those and other forms of alternative energy have become a new source of anxiety. The problem is that renewable energy adds unprecedented levels of stress to a grid designed for the previous century.
Green energy is the least predictable kind. Nobody can say for certain when the wind will blow or the sun will shine. A field of solar panels might be cranking out huge amounts of energy one minute and a tiny amount the next if a thick cloud arrives. In many cases, renewable resources exist where transmission lines don't.
"The grid was not built for renewables," said Trieu Mai, senior analyst at the National Renewable Energy Laboratory.
The frailty imperils lofty goals for greenhouse gas reductions. Concerned state and federal officials are spending billions of dollars in ratepayer and taxpayer money in an effort to hasten the technological breakthroughs needed for the grid to keep up with the demands of clean energy.
Making a green energy future work will be "one of the greatest technological challenges industrialized societies have undertaken," a group of scholars at Caltech said in a recent report. The report notes that by 2030, about $1 trillion is expected to be spent nationwide in bringing the grid up to date.
The role of the grid is to keep the supply of power steady and predictable. Engineers carefully calibrate how much juice to feed into the system as everything from porch lights to factory machines are switched on and off. The balancing requires painstaking precision. A momentary overload can crash the system.
California has taken some of the earliest steps to address the problems. The California Public Utilities Commission last month ordered large power companies to invest heavily in efforts to develop storage technologies that could bottle up wind and solar power, allowing the energy to be distributed more evenly over time.
Whether those technologies will ever be economically viable on a large scale is hotly debated. The commission mandate nonetheless requires companies to produce enough storage by 2024 to power about 1 million homes.
"Energy storage has the potential to be a game changer for our electric grid," Commissioner Mark Ferron said.
Some utility officials warn, however, that the only guarantee is that ratepayers will be spending a lot. The commission's goals, while laudable, "could cost up to $3 billion with uncertain net benefits for customers," Southern California Edison declared in a filing.
But regulators are desperate to move past the status quo. Already, power grid operators in some states have had to dump energy produced by wind turbines on blustery days because regional power systems had no room for it. Officials at the California Independent System Operator, which manages the grid in California, say renewable energy producers are making the juggling act increasingly complex.
"We are getting to the point where we will have to pay people not to produce power," said Long Beach Mayor Bob Foster, a system operator board member.
A bigger fear is that the grid is becoming more vulnerable to collapse, leaving the public exposed to the kind of blackouts that hit San Diego, parts of Arizona and a chunk of Baja California on a blistering hot September day in 2011.
Rush-hour traffic jammed as streetlights went dark. Flights were grounded. Pumping stations came to a halt, causing sewage to flow onto beaches. People were trapped in office elevators and on rides at Sea World.
An employee's misstep at a substation near Yuma, Ariz., caused that blackout, but energy experts see it as a harbinger of the sorts of problems that could become frequent if the nation fails to refashion its outmoded power grid.
Foster has been working with other regulators and power company executives to redesign the system. The work involves ideas for mapping and building vast networks of electrical lines, industrial-scale solar- and wind-power plants and backup natural gas plants that can keep the lights on when shifts in weather cause renewable sources to falter. That's the tangible stuff they can easily explain.
But the grid is also built on an antiquated tangle of market rules, operational formulas and business models. It makes for a formidable riddle.
Planners are struggling to plot where and when to deploy solar panels, wind turbines and hydrogen fuel cells without knowing whether regulators will approve the transmission lines to support them.
"One of the biggest challenges is you can't create a market for these resources without solving the demands of moving electricity from one physical place to another," said Neil Fromer, executive director of Caltech's Resnick Sustainability Institute. "But you can't solve that problem until you understand what the market structure looks like."
Back in Colorado, Peregrine is furiously working to map out grid scenarios involving wind, solar and other forms of renewable energy. Sharing space with Peregrine at the Energy Systems Integration Facility is a "visualization room" with a 16-foot screen that creates 3-D images of how different wind patterns interact with turbines, or how molecules interact inside a solar cell.
Federal regulators see an expanded role for themselves as the best hope for powering the nation with as much as 80% renewable energy within the next 35 or so years. Maintaining stability will hinge increasingly on interstate cooperation, they say.
But state regulators are reluctant to cede authority. That's particularly true in California, where bitterness over the energy crisis of more than a decade ago remains intense and makes officials reluctant to cede an inch of jurisdiction to Washington.
Regardless of who wins that power struggle, some of those involved in the day-to-day business of keeping the lights on in California say the limitations of the grid will undermine efforts by activists to move more quickly to reduce greenhouse gas emissions from power plants.
At the Independent Energy Producers Assn. in Sacramento, which represents owners of renewable and gas power plants, Executive Director Jan Smutny-Jones says proposals by academics and others to move California to as much as 80% renewable energy within the next two decades are bumping up against the challenges of avoiding another San Diego-type blackout.
"Some day that may be the way the world is going to work," he said. "But in the next five or six years, it is not."