Hacker News new | ask | show | jobs
by bake 1371 days ago
Hi! Yes, the simulation is all server-side. It does take a while today -- we aren't using the beefiest machines for the site, but even locally it's a >5s process.

Some of the things driving speed:

- Fetching hourly weather data -- we use binned data for the 15-30 years used for equipment sizing and selection, but for the 12 month backtest to get savings and emissions, we're going hour by hour through the last year for the simulation.

- Loading + merging emissions data -- same deal for hourly grid emissions for your local grid, to get emissions from electricity usage (though we do make some assumptions about the grid decarbonizing when we show expected lifetime emissions figures).

- Simulating thermostat behavior -- we do some extra processing before the core simulation to model realistic human behavior on thermostat setting, so that you don't get lots of flipping between heat+cool in shoulder months or the furnace kicking on in June just because it hits 68dF in the middle of the night.

- Heat pump equipment selection -- we're doing a slightly simplified version of the backtest over 15-30 years of historical data for ~2k heat pump units (depending on ducting type) as a bake-off to choose the most efficient-but-properly-sized heat pump for the home. There's more optimization to be done there, but it's about 2-3s of the total time currently.

- Backtest itself -- once we have the equipment chosen and the weather + thermostat scenarios created, we run the simulation itself for the last 12 months, twice (once for the status quo equipment, once for the heat pump configuration). That goes through each hour of the year, simulating heat load on the home (outside weather including cloud cover and solar positioning, humidity, wind speed, temperature, plus internal loads like appliances and the heat occupants give off), simulating equipment performance (for heat pumps, a function of output, outside temp, inside temp, outside humidity, altitude, and layering in backup heat as applicable/needed), plus accounting for surplus/deficit heat that needs to roll over to the next hour based on thermostat settings or insufficient conditioning, etc. etc.. With usage, we then compile and calculate the utility bills monthly (we have support for actual rate plans, TOU plans, etc., but for now we just use statewide marginal retail prices from the EIA for the site version, because those tend to be conservative) and also calculate emissions, which is time intensive for electricity given we're layering in actual emissions from the grid in the simulated hour.

Anyways, there's definitely a lot of optimization we could do to get the processing time down, but hope that gives you a sense of what's going on server-side. Also, the model we're running is more flexible than what's exposed on the site currently (e.g. arbitrary date ranges for the backtest), and if we made a more specialized version of it, we could do a lot more pre-computing.