Saber: Building Audit Tool
The building energy audit tool used by students in CU Boulder’s Civil, Environmental and Architectural Engineering (CEAE) department, roughly 900 undergraduate and graduate students. It calibrates an energy model from a year of utility bills and shows which retrofits pay for themselves.
5 min readTry it live

A building’s utility bills already know when its heating kicks in. Saber reads them, builds a calibrated energy model, and prices out every upgrade worth doing.
What I shipped
Saber is a building energy audit platform for the BEST Center, built out of Larson Lab at CU Boulder. An auditor describes a building, uploads twelve months of electricity and gas bills, and gets back a calibrated baseline plus savings, cost, payback and net present value for every energy conservation measure (ECM) they want to test.
Before this, the whole thing was a PyQt5 desktop app. It worked, but you needed the right conda environment, the right Python version and someone from the lab sitting next to you. Nobody outside the lab was ever going to use it. I rebuilt it as a web product that anyone can open in a browser.
The ~4,100 lines of Python analysis engine were reused, not rewritten, and now sit behind a REST API. The 120+ measure options span insulation, windows, infiltration, HVAC, DHW, lighting and controls. It’s been tested against 15 real buildings, mostly churches and parsonages across Colorado and Montana. Try it live .
How it works
Two services, one shared Linux plan. A Next.js and TypeScript front end talks to a FastAPI back end that wraps the original modeling engine. Both run as containers on Azure App Service.
Swipe to see the whole diagram →
The core idea is inverse modeling. Instead of simulating a building from first principles (which needs hundreds of inputs nobody has), Saber works backwards from what the meter actually recorded.
- Describe the building. A seven-step wizard covers geometry, envelope, equipment, HVAC, preferences, analysis and ECMs. Or drop in an existing
.pklbuilding file and the fields fill themselves in. - Find the weather. The building’s coordinates go through a haversine great-circle search to pick the nearest NOAA station, then daily temperatures get pulled and aligned to each billing period.
- Fit the baseline. Monthly energy use is regressed against outdoor temperature with piecewise-linear change-point models: 3P heating, 3P cooling, 4P and 5P. The search sweeps candidate balance points and keeps the fit with the best R². The balance point is literally the temperature where the heating turns on.
- Split it into end uses. Degree-day heat balance and a building load coefficient break the total into heating, cooling, lighting, equipment and hot water.
- Test retrofits. Each measure changes conduction, infiltration or system efficiency, and the calibrated model reruns to estimate the new consumption.
- Price it. Present value and life-cycle cost with a user-set discount rate (default 3%) and lifetime (default 20 years) give payback and NPV per measure and per package.
Swipe to see the whole diagram →
Desktop to web: what had to change
Porting a scientific desktop app is not a UI reskin. The engine assumed one user, one machine and a local filesystem. Here is what broke and how I handled it.
| Problem in the desktop version | What Saber does now |
|---|---|
| Ran only on a lab machine with a fragile conda setup | Dockerized scientific Python stack, open in any browser |
| PyQt5 forms with no validation | Typed form state (types/form.ts) driven by a reducer with one-way data flow |
| Every ECM run refit the baseline from scratch | Baseline fit is cached per project, so ECM runs only pay for the new work |
| Analysis blocked the whole app | CPU-heavy fits run in a bounded two-worker thread pool, so the API stays responsive |
| Server restart meant losing state | Cache rebuilds itself from the submitted form data on the next ECM request |
| Weather downloads changed the working directory | Locked and isolated so concurrent users do not step on each other |
Opened any .pkl file with plain pickle.load() | Restricted unpickler that only rebuilds pandas and numpy data |
| Long dropdowns, desktop-only layout | Searchable selects and a mobile layout |

The part I am proudest of: safe uploads
Auditors share buildings as pickled pandas DataFrames. That is convenient and also a remote code execution hole. A normal pickle.load() will call any function the file names, so one crafted upload could run shell commands on the server.
I wrote a restricted unpickler that allows only the types a DataFrame actually needs: pandas and numpy classes, their own reconstruction helpers, and a short list of harmless builtins like datetime and Decimal. Anything that touches files, evaluates expressions or plots (pandas.io, pandas.core.computation, numpy.lib, and friends) is blocked before it loads. Dotted names are rejected too, so nobody can reach a method like DataFrame.to_csv through the back door.
Existing building files keep working. Malicious ones never execute.
Shipping it
- Hosting. Both services on Azure App Service (Web App for Containers) sharing one Linux plan, images in Azure Container Registry.
- Right-sizing. Started on the B3 tier. Measured about 360 MB of combined average memory over seven days, then dropped to B2. Same performance, lower bill.
- Health checks that mean something.
/healthimports the analysis engine, confirms the reference data is on disk and that upload storage is writable with 200 MB free. Any failure returns a 503 so monitors actually alert. The footer shows a live status light that polls it every 60 seconds. - Security. HTTPS only, TLS 1.2, HSTS, CORS locked to the Saber front end, 20 MB upload cap, path traversal protection on project names, and server errors that log details but never leak a stack trace to the browser.
- Feedback loop. Most of the 76 commits came straight out of review rounds with the faculty and lab team. Ship, get comments, fix ECM edge cases, ship again.
Results
What a run gives back for a typical building:
| Output | What you get |
|---|---|
| Baseline model | Best-fit change-point type (3P, 4P or 5P), balance point, R² |
| Calibration check | Modeled vs metered use, month by month, for electricity and gas |
| End-use breakdown | Heating, cooling, lighting, equipment and hot water |
| Per-measure economics | Annual savings, installed cost, simple payback, NPV |
| Packages | Combined measures, rerun through the model so savings do not double count |
| Export | PDF report and a .pkl file you can load back later |
The real win is not any one chart. It is that an energy audit which used to mean installing software on a lab computer is now a link you can send to a facilities manager. Open Saber .
Resources
- Kissock, Haberl and Claridge, Inverse Modeling Toolkit: Numerical Algorithms | ASHRAE Transactions, 2003
- ASHRAE Guideline 14, Measurement of Energy, Demand, and Water Savings
- Krarti, Energy Audit of Building Systems: An Engineering Approach | CRC Press
- NOAA NCEI, Integrated Surface Database
- FastAPI
- Azure App Service documentation | Microsoft Learn
- Python docs, pickle: restricting globals
- Saber, live
