Portfolio project · Energy economics

How solar reshaped the Texas power grid, and how well its demand can be forecast

Seven years of hourly data from ERCOT, the Texas grid operator, analyzed with SQL (DuckDB) and Python: demand, generation by fuel, prices, weather, and a day-ahead forecast scored against ERCOT's own on equal terms.

Electricity demand follows temperature

Hourly load on the Texas grid is U-shaped in temperature. It is lowest around 16 °C, when people need little heating or cooling, and climbs fastest in summer heat. The hours below −9 °C on the left of the chart are Winter Storm Uri, when load was shed by rolling outages rather than measured as true demand.

Scatter plot of ERCOT hourly load against temperature, 2019 to 2025: load is U-shaped, lowest near 16 degrees Celsius and highest in summer heat

Open the interactive version → (large, about 1.4 MB)

ERCOT hourly load vs. temperature, 2019 to 2025. Temperature is a load-weighted average of eight Texas cities.

Demand is growing, and weather isn't the reason

ERCOT's annual peak rose about 15% from 2019 to 2023 and then held nearly flat, with 2024's 85.5 GW only just above 2023. To find out whether that is growth or just hotter summers, I fit log hourly load on temperature (separately for each hour of the day), the calendar, and a year effect. The year effect is the change in load at identical weather.

Open full size →

Load growth relative to 2019, actual and weather-adjusted. Uri and the Hurricane Beryl outage period are excluded.

The duck curve has arrived in Texas

Solar output peaks at midday, when it pushes net load (demand minus wind and solar) down, then falls away just as people come home. Spring midday net load sank to about 21 GW in 2025, and the average daily maximum three-hour evening ramp grew from 3.1 GW in 2019 to 13.8 GW in 2025. The single steepest ramp rose from 13.4 GW to 30.1 GW. Solar's share of midday generation (11 am to 3 pm) went from 2.5% to 32.9%.

Open full size →

Average spring-day net load by hour ending (Central time). Midday net load has sunk as solar grew, and the evening ramp has steepened.

Over the same period total generation grew 27% (383 to 488 TWh). Coal fell from 20.4% to 13.0% of annual generation, gas stayed the largest source (41 to 47%), and wind plateaued near 24%.

Winter Storm Uri

Served demand peaked at 69.2 GW in the hour ending 8 pm on February 14, 2021. Over the next 54 hours generation fell 38.7% (68.0 to 41.7 GW): gas down 15.6 GW, wind 4.8 GW, coal 4.6 GW, and nuclear 1.4 GW. EIA reports served demand, so it fell in step, to about 43 GW.

ERCOT's own day-ahead forecast ran up to 28.9 GW above served demand, peaking at 76.8 GW, and 1,568 GWh above it over February 15 to 18. That gap is an upper bound on load shed, because it also includes forecast error and conservation.

Open full size →

ERCOT generation by fuel vs. served demand and ERCOT's forecast, February 11 to 21, 2021. The shaded period marks rolling outages, when served demand was capped by supply.

Does the gas price move the generation mix?

Gas and coal compete for the load left after wind, solar, and nuclear, so I measure the gas share of fossil generation (gas divided by gas plus coal) by day. Uri is excluded, because its price spike came with forced outages, not economic dispatch.

Controlling for net load, month, and year, doubling the Henry Hub price cuts gas's share of fossil generation by 1.6 points (95% confidence interval 0.5 to 2.6, from a 72% average). Adding weather controls, a coal capacity proxy, or limiting the sample to mild days gives 1.6 to 2.1 points.

The link looks weaker than it was: 8.7 points per doubling in 2019 and 0.9 to 2.9 points since 2022, although the 2023 and 2024 estimates are each too noisy to tell from zero.

Open full size →

Change in gas share of fossil generation per doubling of the gas price, by year. Bars show 95% confidence intervals, which are wide in several years.

Why it faded: what this data can and can't say

The natural story is that coal retirements left less room to switch. I tested it with two proxies built from earlier days' coal output, and it only partly holds up:

So I treat this as a description, not a causal estimate. Cold snaps and heat waves move gas prices, demand, and plant availability together, and Henry Hub is a national price, not what Texas plants pay. A Texas hub price and actual plant availability would be the next step; I did not find a free daily series for either.

Forecasting demand a day ahead

ERCOT posts its forecast at 9:30 am the day before delivery, so I built mine under the same rule. Load is known only through hour ending 9 am the day before, and weather comes from archived forecasts, using the newest model run already published at 9:30 am. My first version used actual temperatures and the previous day's full load. It scored 2.52%, but that comparison was not like for like, so it now appears only as a reference.

The model is gradient boosting that predicts the ratio of load to a baseline, the average of the same hour over the last 14 fully known non-holiday days. Its inputs are the calendar, forecast temperature, the previous morning's load, and recent weather. I trained on 2019 to 2023 and tested on 2024 to 2025. Inputs were compared by cross-validation across 2022 and 2023, and settings were tuned on 2023, which cut cross-validated error from 3.17% to 2.99%.

ForecastRMSE (MWh)MAPE (%)
Baseline: same hour last week6,4828.53
Mine, 9:30 am information only2,2383.05
ERCOT 9:30 am posting1,8102.38
Reference: mine with hindsight on weather and load1,9712.52

Test set: 17,489 hours scored by every forecast. ERCOT's forecast as filed with EIA scored 2.31% on the same hours; I compare against the API posting because its 9:30 am timing is documented.

How it compares with ERCOT

ERCOT wins clearly. My forecast beat its posting on 30% of days, and it trailed in both years (3.14% vs. 2.24% in 2024, 2.95% vs. 2.53% in 2025) and in every season. It removes about two-thirds of the baseline's error, which is the fair claim. Hindsight was worth about half a point: the same project scored 2.52% with it and 3.05% without.

The two forecasts also lean opposite ways. Mine under-forecasts by about 300 MWh on average, and ERCOT's over-forecasts by about 410 MWh.

Open full size →

Forecast error by season, test set 2024 to 2025. Winter is the hardest season for all three.

Peak hours

Grid operators care more about the summer peak than about 3 am, so I scored those hours separately.

MeasureMineERCOT
Error, summer 4 to 8 pm3.05%2.39%
Error on the size of each day's peak2.98%2.46%
Days the peak hour was called exactly37%59%

What drives the model

I shuffled each group of inputs on the test set to see how much accuracy falls.

Open full size →

Rise in forecast error (percentage points of MAPE) when each group of inputs is shuffled.

Recent weather is in the model because buildings hold heat and cold, so a hot night raises the next day's load. The evidence is uneven. Adding rolling temperature and the overnight low cut 2022 validation error from 3.65% to 3.34%, and left 2023 about the same (3.15% to 3.17%).

Holidays: a fix that didn't work

My model's first version anchored on yesterday's load, so the day after a holiday anchored on holiday-level demand. The baseline now skips holidays, but that did not help: error on holidays stayed at about 4.0%, and error in the two days after them was 3.47% with the fix against 3.39% without it. ERCOT scored 2.9% on both. A simpler fix, anchoring on a single day a week earlier, made holiday-period error worse in validation. With about ten holidays a year, this remains the model's clearest weak spot.

The ten biggest misses

DateMineERCOTContext
2024-07-0819.3%16.3%Hurricane Beryl landfall near Houston; about 2.2 million customers lost power
2024-01-1514.1%4.8%MLK Day, freezing; temperature forecast ran 6.8 °C warm
2024-05-1710.2%10.2%Day after the Houston derecho
2024-01-149.8%6.0%Freezing; temperature forecast ran 7.0 °C warm
2024-05-289.7%9.0%Day after Memorial Day
2024-07-099.1%9.7%Beryl outages continuing
2024-01-299.1%1.2%No clear driver in the data
2024-05-168.2%5.6%Houston derecho
2024-11-018.0%2.9%No clear driver in the data
2024-06-057.9%8.7%No clear driver in the data; ERCOT missed too

Mean absolute percentage error for the day. Temperature misses come from the data; Beryl and the derecho are labeled by hand. January 14 and 15 fall in the three weeks where the weather forecast comes from a backup model.

Two bugs I found and fixed

Load levels as inputs. My first version also fed yesterday's and last week's load levels in as inputs. In 2019 to 2023 the model learned that unusually high-load days tend to be followed by drops. In 2024 and 2025, load is high every day because of growth, so it kept predicting drops that never came and under-forecast by about 1,000 MWh. Removing those inputs cut test error from 2.94% to 2.52%. I chose the change on the 2023 validation year, not the test set. I found it while testing whether commuters switching on heating and AC at 6 pm explained that hour's errors: it did not, and a correction for it made 6 pm slightly worse.

Row order in the gas regression. Newey-West standard errors assume rows are in time order, and my query didn't guarantee it. Sorting by date widened the confidence interval from 0.8 to 2.3 points to 0.5 to 2.6.

What this means for the industry

ERCOT's public day-ahead prices put numbers on the physical changes above.

Open full size →

Median spring day-ahead price, midday and evening, 2019 to 2025. The 2022 spike reflects high gas prices.

Data and methods

Data

Pipeline

SQL files in DuckDB build a star schema (calendar and fuel dimensions, fact tables for load, generation, weather, forecast, and gas price) and a wide hourly modeling table with window-function features: a 7-day rolling average, hourly ramps, and lags. Python (pandas, scikit-learn, statsmodels) runs the models, regressions, and charts in Plotly. All timestamps are stored in UTC and converted to Central time only for calendar fields; EIA hourly values are hour-ending.

Data quality

The quality checks found one missing demand hour (the daylight-saving fall-back hour in 2021, interpolated and flagged), 122 hours on five days in 2019 to 2020 where gas generation was misfiled as "Other" (added back to gas and flagged), and no duplicate or negative values. The full table is in the repository README.

Limitations