sunsolarcalculator.com

Building an Hour-by-Hour Solar Calculator

Solar pays most for the power you use as it's made. Everything sent to the grid earns less, often much less. So a solar calculator lives or dies on one question: when does your home use power, compared with when the panels make it? Mine answered that with a shortcut, and I wanted to know what the shortcut was costing.

I worked on this with Claude, Anthropic's AI model. I asked the questions and made the calls. Claude wrote the test code, ran the numbers and dug up the sources. Here's what we found.

One averaged day a month

The original engine imagined one typical day per month. Production rose and fell in a smooth curve, and the home's use was split into fixed daytime and evening shares. A battery could only discharge from 4 to 9 PM.

I suggested testing it against something closer to real life, and Claude ran the tests. NLR, the national lab once called NREL, publishes hour-by-hour simulations of homes built to match the actual housing in each county. We took 50 single-family homes in each of the calculator's 14 markets, 700 in all, and ran every one for a full year, hour by hour, against NLR's PVWatts solar data for the same place.

The averaged day under-counted the share of solar a home uses directly by 5 to 11 percentage points. It also gave west-facing roofs credit for evening hours they don't really reach, and its batteries got the evening wrong.

How much data is enough?

My first worry was size. Would a realistic engine mean a huge download for every visitor? So we tested how little data we could get away with.

The obvious move is to average: one smooth curve from many homes. It turned out to be the wrong one. Homes are lumpy. Their use jumps around and often lands outside the sunny hours. An average spreads it evenly underneath the solar, which flatters it.

One May day: one home's use, the average of 50 homes, and a 4.6 kW system's output, hour by hour0 kW1 kW2 kW3 kW4 kWmidnight6 AMnoon6 PMmidnightSolar output: 29 kWh that dayAverage of 50 homes: 20 kWh that day, 9.5 kWh met by solar as it was madeOne home: 18.4 kWh that day, 8 kWh met by solar as it was madeSolarAverage of 50One home
One sample home in Marin County on May 21 (solid) against the average of all 50 sample homes (dashed), both scaled to 8,000 kWh a year, beside a 4.6 kW south-facing system. Over the full year, a typical home used 38.4% of its solar as it was made. The averaged curve claims 41.6%.

Averaged curves overstated savings by 5 to 8%. What worked was keeping homes and days whole, just fewer of them. For each market, the calculator keeps five simulated homes for each of three usage patterns (out most of the day, mornings and evenings, home all day) and 10 to 15 real days per month, each standing in for a group of similar days. It runs all five homes and averages their results, never their curves.

I set the target: savings within about 2% of the full hour-by-hour answer, and the 10-year return within 0.3 percentage points (7.3% instead of a true 7.0%, say). On homes the method hadn't been tuned on, it hit that target far more often than the old engine.

Share of test cases within the accuracy target: old engine 11%, new engine 86%0255075100Old engine (one averaged day)Old engine (one averaged day): 11%11%New engine (sample homes and days)New engine (sample homes and days): 86%86%
Share of test cases, across the 14 markets, where the result landed within the accuracy target.

And the size worry went away. Each market's files are about 25 KB, and a visitor only downloads the ones for their own market.

Ideas that came from poking at it

Electric heat. I asked what happens when you change the usage figure, since the sample homes each had their own. Claude ran it: small and medium homes were fine, but the biggest ones came out too optimistic, and nearly all of those heated with electricity. Their use piles up on winter mornings and nights, when panels make little. My idea was to keep each sample home's always-on level fixed and stretch only the rest. That halved the error. Adding a question about how you heat your home closed the gap.

How much savings were overstated for homes with electric heat, before and after the heating questionOriginal methodBaseline held, plus the heating question02468101214Resistance heat (205 homes)Resistance heat (205 homes), before: 11.8%11.8%Resistance heat (205 homes), after: 0.1%0.1%Heat pump (72 homes)Heat pump (72 homes), before: 8.4%8.4%Heat pump (72 homes), after: 0.3%0.3%
How much savings were overstated for 277 homes that heat with electricity, against each home's own full year.

The car. When I played with the beta, the car charging looked wrong to me: too fast, and too late in the day to use the sun. I proposed a rule: never charge from the grid at peak prices. The calculator now charges the way a smart charger would, from the panels when the sun is up and the rest overnight. You can switch to "charge as soon as it's plugged in" to see what that costs.

10-year return for one sample system by when the car charges−202468From the panels, rest overnightFrom the panels, rest overnight: 6.7%6.7%A fixed 1–5 PM block (old)A fixed 1–5 PM block (old): 6.0%6.0%When plugged in, 6–10 PMWhen plugged in, 6–10 PM: −0.7%−0.7%Overnight onlyOvernight only: −0.9%−0.9%
10-year return for the First system sample in Marin (west roof, PG&E's E-ELEC plan) by when its car charges.

Rates. Once the engine knew the hour, rates became the weak spot. Most time-of-use plans change with the season, so the calculator now prices each hour from the real plan. The national rate database had errors: one plan priced its winter peak as off-peak on some weekdays, another had its summer peak in the wrong hours, and LADWP's prices were several cents out of date. Claude now checks each plan's hours against the utility's own rates wherever it can find them, but it isn't easy or 100% reliable with such variability in how these things are reported.

I had another AI run a quote from a Reddit post through the old calculator: 15 kW in Los Angeles for $32,000. The new engine alone changed nothing on that quote. The rates changed everything.

Payback on a real Los Angeles quote by how electricity is priced01234567Flat 22¢ (old preset)Flat 22¢ (old preset): 5.8 yr5.8 yrLADWP’s 2026 prices, by the hourLADWP’s 2026 prices, by the hour: 4.8 yr4.8 yr…plus the 10% city tax…plus the 10% city tax: 4.4 yr4.4 yr
Payback for the same 15 kW, $32,000 quote under LADWP net metering. The old engine and the new one agree at a flat 22¢.

An idea I dropped

I also asked for an "optimize for return" button. Claude built it, and its first answer surprised us both. Under California's current export rules, a system sized to cover all of a home's use returned 1.4% a year in one test, while one about 40% of that size returned 10.7%. Exports earn so little that extra panels lose money. Since price per watt is only an estimate, and real quotes depend on much more, I decided a button like that would mislead more than help. The calculator will still show you the effect if you change the system size yourself.

What more data can't fix

Even when the calculator is right about a typical home, your home isn't typical. The middle half of the 700 test homes landed between 2% below and 3.5% above the prediction for their pattern. Your own meter readings would close that gap, so we're building a way to load your utility's Green Button download.

Try it

The new engine now runs the rooftop calculator. Pick your location and you'll see the rates and export rules it starts from, each with its source and the date it was checked. Anything we couldn't confirm, or haven't checked in over a year, is marked in red. If something looks wrong for where you live, I'd like to hear about it.