Climate Change: Simple, Serious, Solvable › Models and Data
Keeping the Lights On: A Year of Sun, Wind and Demand
Electricity has to be made the moment it's used, every hour of the year. Take a real grid and a real year of weather. Build solar and wind, then use the five tools of Chapter 12 and see how close you can get to running the whole year on clean power.
- Clean firm power
- Wind
- Sun
- Batteries
- Short of clean power
- Use
Clean power above the line of use charges the batteries, or is thrown away when they're full.
| Clean power meets | |
|---|---|
| Short of clean power | |
| The biggest shortfall in one hour | |
| Thrown away | |
| Use |
Short of clean power is what something else has to make. In 2025 that was mostly gas and coal. The biggest shortfall in one hour is how much of that backup the grid has to keep ready.
This is a very simple model. It's five steps of bookkeeping, hour by hour, with one real year of weather. It has no prices. The About tab has every step.
About this model
A power grid has to make electricity at the same moment people use it, every hour of the year. Sunshine and wind come and go with the weather, and people's use goes up and down too. Chapter 12 of the book calls matching them grid integration, and names five tools for it: manage demand, mix sources that peak at different times, store energy, send it far, and add a small share of clean firm power. This page lets you try all five on a real grid, with every hour of 2025.
The page opens on MISO, the grid that runs much of the Midwest, with what it had in 2025: 16.7 GW of solar panels, 32.6 GW of wind turbines and 11.6 GW of nuclear and hydropower. Clean power met 34.7% of the year's use. The rest came from other power plants, mostly burning gas and coal.
How to use this page
Choose a grid: MISO (the Midwest), PJM (the Mid-Atlantic) or CISO (California). "What this grid had in 2025" sets the solar, wind and clean firm power it had, with no batteries, no use that waits and nothing wired in. Then use the tools:
- Mix sources. Set the solar panels and wind turbines, in gigawatts (GW) of capacity, from 0 to 300 each.
- Store energy. Set the batteries, in gigawatt-hours (GWh), from 0 to 2,000. Each holds four hours of its power, so 400 GWh of batteries can give 100 GW for four hours.
- Manage demand. Set the share of each day's use that can wait, from 0 to 30%.
- Send it far. Choose where the solar and wind are: all here, or half built in one of the other two grids' weather and wired in.
- Clean firm power. Set the gigawatts of nuclear, hydropower or geothermal that run every hour, from 0 to 60.
The top graph shows the year, day by day. The black line is each day's average use. Under it, stacked, is the clean power that meets it: clean firm power, wind, Sun and the batteries. Red is the shortfall. The second graph shows one week, hour by hour. Choose the week, or press "The worst week" to see the week with the biggest shortfall. The table gives the year's numbers. "Back to where the page opened" puts everything back.
The address in your browser changes as you work, so you can bookmark a view or send it to someone. Nothing is sent anywhere as you work.
This page is part of the website for Climate Change: Simple, Serious, Solvable, an open textbook by Scott Denning. It goes with Chapter 12, "Reinventing Fire", section 12.4.
The equations
You don't need any of this to use the page. But the whole model is bookkeeping, one hour at a time, and you can follow any hour with a calculator.
The model answers one question: with this much clean power, storage and flexibility, how much of a real year's electricity could be clean?
Power is in gigawatts. One gigawatt for one hour is a gigawatt-hour. The data give, for each of the 8,760 hours of 2025, what people used, D, and how hard the grid's solar panels and wind turbines worked: their capacity factors, the share of their full power they made that hour.
1. How hard do the Sun and the wind work?
The capacity factor this hour is the grid's own, ch, unless a share f of the panels and turbines is built in a neighbor's weather, with capacity factor cn:
The page builds either nothing or half far away, so f is 0 or 0.5. When it's cloudy here and sunny there, the mix is less cloudy than either.
2. How much clean power is made?
Ps gigawatts of solar panels working at cs, Pw of wind turbines at cw, and F of clean firm power running all the time make
gigawatts this hour.
3. When do people use it?
A share w of each day's use can wait: cars that can charge later, water heaters that can heat earlier. The model takes that share out of every hour of the day and puts it back where there's spare clean power that day, more where there's more. What doesn't fit stays where it was. The day's total use doesn't change. This is the first of Chapter 12's tools, managing demand, in a simple form: nothing moves from one day to the next.
4. What do the batteries do?
Batteries holding E gigawatt-hours can charge or give power at
gigawatts: they empty in four hours, like Box 12.2's battery of 50 MW and 200 MWh. In an hour when the clean power is more than the use, the extra charges the batteries, as fast as their power allows, until they're full. Whatever's left is thrown away: the grid can't use it, and the chapter calls that curtailment. In an hour when the clean power falls short, the batteries give what they can, B, as fast as their power allows, until they're empty. Whatever's still missing is the shortfall:
gigawatts this hour. Something else has to make it: on today's grids, mostly power plants that burn gas or coal. The batteries start the year half full.
5. How clean is the year?
Add up every hour's shortfall, Sy, and every hour's use, Dy. The share of the year's use met by clean power is
The table shows K as a percentage, and also the hours with a shortfall, the biggest shortfall in any one hour, and the share of the clean power made that was thrown away.
Where the equations stop
- No prices. The page says what works, not what it costs. Chapter 12 has the costs.
- 2025's use. Electric cars, heat pumps and data centers will add to it. The page uses the year as it was.
- The weather of one year. Another year would have different calm, cloudy weeks.
- Perfect wires and batteries. Each grid is treated as one place: the model doesn't track power lines inside it. The wire to a neighbor carries any amount, loses nothing on the way and costs nothing. A real line to California would be thousands of kilometers long. The batteries lose nothing in a round trip, and real ones lose a little.
- The Sun and wind of 2025's fleets. More panels and turbines work like the ones already built. In California, where some solar power was already thrown away in 2025, the capacity factors are a little lower than the panels could have made.
- 2025's batteries. Real grids already had some batteries in 2025, California most of all. "What this grid had in 2025" leaves them out.
A worked example
Open the page. It's MISO with what it had in 2025, and no batteries. In this year, MISO's clean power never once ran past its use, so nothing was thrown away and the sum is short: the clean share is all the clean power made, divided by all the use. The data give each in gigawatt-hours.
- The solar panels (Box 12.1). They made 29,751 GWh. A year has 8,760 hours, so 16.7 GW of panels at full power all year would have made 16.7 × 8,760 = 146,292 GWh. Their capacity factor was 29,751 ÷ 146,292 = 20.3%.
- The wind turbines. They made 98,946 GWh: 98,946 ÷ (32.6 × 8,760) = 34.6%.
- Clean firm power. Nuclear made 91,677 GWh and hydropower 9,877. Together that's 101,554 GWh, or 101,554 ÷ 8,760 = 11.6 GW every hour.
- All the clean power. 29,751 + 98,946 + 101,554 = 230,251 GWh.
- The clean share (step 5). People used 663,827 GWh. 230,251 ÷ 663,827 = 0.347, so K is 34.7%.
The table says clean power meets 34.7% of the year's use.
See the equations at work
Start each from "What this grid had in 2025" on MISO.
- Solar alone. Set the wind and the clean firm power to 0 and the solar panels to 150 GW, nine times what MISO had. Clean power meets only 36.3% of the year's use, and 9.8% of what the panels make is thrown away: the Sun sets every night, and on most days the panels make more at noon than anyone uses.
- Add wind. Now set the wind turbines to 150 GW too. Clean power meets 81.6%. The wind often blows at night and in winter, when the Sun doesn't help (step 2).
- Add batteries. Set the batteries to 400 GWh. Clean power meets 89.6%, but the biggest shortfall is still 90.5 GW. Press "The worst week": it starts on September 17. That week MISO's wind turbines worked at 12% of their full power, against 35% over the year. Four-hour batteries can't fill a calm week (step 4).
- Send it far. Build half in California's weather. Clean power meets 94.5%. Build half in the Mid-Atlantic's instead, and it meets only 86.6%. The Mid-Atlantic's wind rises and falls with the Midwest's, so it's calm when the Midwest is calm, while California's wind has its own rhythm (step 1).
- Add clean firm power. Go back to building it all here, and set the clean firm power to 15 GW. Clean power meets 96.5%, and the biggest shortfall shrinks to 73.1 GW.
Where the data come from
Every hour of 2025 for each grid is from the US Energy Information Administration's Hourly Electric Grid Monitor: what people used, and what the grid's solar panels and wind turbines made. Each hour's capacity factor is what the panels or turbines made, divided by how many were built at the time, from the EIA's monthly list of every generator in the country. The year's nuclear and hydropower are from the same hourly records. The year runs on Eastern Standard Time.
A few hours needed repair, and each repair is recorded: a few hours missing from the record, filled in from the hours on either side; single hours far from both their neighbors, replaced by their neighbors' average; the last hour of each day in PJM's wind record from January 1 to February 11, which carried other days' readings; and California's solar panels drawing a little power at night, set to zero.
US Energy Information Administration (2026). Hourly Electric Grid Monitor (Form EIA-930), six-month balance files for 2025. eia.gov/electricity/gridmonitor
US Energy Information Administration (2026). Preliminary Monthly Electric Generator Inventory (Form EIA-860M), September 2026. eia.gov/electricity/data/eia860m
The EIA's data are a US government work, in the public domain.
How it was checked
A set of tests comes with the model, and they run every time the page changes. Here's what they hold it to.
- The code, against a second copy. The tests have the steps written out a second time, in another programming language, and run whole years with both. They agree to within a millionth.
- Energy, every hour. The clean power made plus what the batteries give equals the use met plus what charges the batteries plus what's thrown away, in every hour; and the batteries never hold less than nothing or more than they can.
- The year as it was. Set to what each grid had in 2025, the model gives back the clean share the EIA's records show, to within a tenth of a percent for MISO and PJM. (California's is lower, because the model throws away the few hours when its clean power ran past its use.)
- The data, against the EIA's files. Every file is checked against its fingerprint, and the data file is made again from them.
- This tab, against the model. Every equation above is tried with the model's own numbers, the worked example is done again from the data, and each number in the text is worked out again from the model.
The code
The code is small enough to read. Two files do all the work, and they use no outside software. The comments in model.js use the same step numbers and letters as the equations above.
model.js is the science: the five steps, hour by hour.
app.js is the page: the controls, the graphs and the table.
To keep a copy, save model.js, app.js or data.json.
All of the model's code is on GitHub, at github.com/airscottdenning/climate-models. You're free to use it, change it and teach with it.
Credits
By Scott Denning, for Climate Change: Simple, Serious, Solvable.
Claude, from Anthropic, wrote the model to run in your browser, from Chapter 12 and the EIA's data, and checked it against the book.