Open-source building energy analytics library from BETTER (Building Efficiency Targeting Tool for Energy Retrofits)
Project description
BETTER-LBNL-OS
Open-source Python library for building energy analytics, serving as the analytical engine underlying the Building Efficiency Targeting Tool for Energy Retrofits (BETTER) web application. BETTER is a software toolkit that enables building operators to quickly, easily identify the most cost-saving energy efficiency measures in buildings and portfolios. BETTER is made possible by support from the U.S. Department of Energy (DOE) Building Technologies Office (BTO).
Features
- Change-point Model Fitting: Automated fitting of 1-, 3-, 5-parameter (1P/3P/5P) change-point models for building energy analysis
- Building Benchmarking: Statistical comparison of building energy performance against peer groups
- Energy Savings Estimation: Weather-normalized energy savings calculations with uncertainty quantification
- Energy Efficiency Measure Recommendations: Rule-based recommendations for energy efficiency improvements
- Portfolio Analytics: Aggregate analysis across multiple buildings
Installation
Using pip
pip install better-lbnl-os
Using uv (recommended)
uv add better-lbnl-os
Development Installation
git clone https://github.com/LBNL-ETA/better-lbnl-os.git
cd better-lbnl-os
uv venv
uv pip install -e ".[dev]"
Quick Start
from better_lbnl_os import fit_changepoint_model
import numpy as np
# Prepare temperature and energy data (showing heating and cooling patterns)
temperatures = np.array([30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85]) # °F
energy_use = np.array([150, 140, 125, 110, 95, 85, 80, 80, 85, 95, 110, 125]) # kBtu/day
# Fit change-point model
model_result = fit_changepoint_model(temperatures, energy_use)
# Check model quality
if model_result.is_valid():
print(f"Model Type: {model_result.model_type}") # 5P (heating and cooling)
print(f"R-squared: {model_result.r_squared:.3f}") # 0.995
print(f"Baseload: {model_result.baseload:.1f}") # 80.0
Documentation
Full documentation is available at https://better-lbnl-os.readthedocs.io
Key Concepts
- Domain Models: Rich objects that encapsulate both data and business logic
- Pure Functions: Mathematical algorithms implemented as side-effect-free functions
- Service Layer: Orchestration of complex workflows
- Adapter Pattern: Clean separation for framework integration
Examples
See the examples/ directory for:
benchmarking_demo.py- Building benchmarking demonstrationnotebooks/explore.ipynb- Interactive exploration notebookweather/- Weather data integration examples
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Install development dependencies (
uv pip install -e ".[dev]") - Make your changes
- Run tests (
pytest) - Run linting (
ruff check . && black . && mypy src) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Testing
Run the test suite:
# Run all tests
pytest
# Run with coverage
pytest --cov=better_lbnl_os --cov-report=html
# Run specific test categories
pytest -m "not slow" # Skip slow tests
pytest tests/unit/ # Only unit tests
License
This project is licensed under a modified Berkeley Software Distribution (BSD) license with additional U.S. DOE government clauses - see the LICENSE and COPYRIGHT files for details.
Citation
If you use BETTER-LBNL-OS in your research, please cite:
@software{better_lbnl_os,
author = {Li, Han},
title = {BETTER-LBNL-OS: Open-Source Building Energy Analytics Library},
year = {2025},
publisher = {Lawrence Berkeley National Laboratory},
url = {https://github.com/LBNL-ETA/better-lbnl-os}
}
Contact
- Project Inquiries: support@better.lbl.gov
- Technical Lead: Han Li (hanli@lbl.gov)
- Principal Investigator: Carolyn Szum (cszum@lbl.gov)
Acknowledgments
This work was supported by the U.S. DOE BTO. BETTER is part of the U.S. DOE Building Data Tools portfolio.
- U.S. DOE Program Manager: Billierae Engelman
- Cooperative Research and Development Agreement (CRADA) Partner: Johnson Controls, Inc.
Related Projects
- BETTER Web Application: Full web-based building analysis platform
- BuildingSync: Standard schema for building data exchange
- SEED Platform: Standard Energy Efficiency Data Platform
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file better_lbnl_os-0.1.1.tar.gz.
File metadata
- Download URL: better_lbnl_os-0.1.1.tar.gz
- Upload date:
- Size: 318.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27576f99b5f4a852eb3cd936dcda8252fec7ef4cbd82e0ca0e1d7c53e202cd4e
|
|
| MD5 |
9a7d80824313d4d078b8df374a4361e4
|
|
| BLAKE2b-256 |
0cf58ba6cc3c980a8ddc1753f157831045033b7e223dc01381f87956cf6c6989
|
File details
Details for the file better_lbnl_os-0.1.1-py3-none-any.whl.
File metadata
- Download URL: better_lbnl_os-0.1.1-py3-none-any.whl
- Upload date:
- Size: 296.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
721d0a6cf1998bc4339a4b4803ee1a4b3026cc3f0769914f67ebb6a6d004e1ba
|
|
| MD5 |
42de914fc3bb33f67c9238ea6a20c401
|
|
| BLAKE2b-256 |
5e1316f66c70a826781beabb697639e4b7d77aea10a6a6bcd5b5a10038e5e6cd
|