Skip to main content

Open-source building energy analytics library extracted from BETTER (Building Efficiency Targeting Tool for Energy Retrofits)

Project description

BETTER-LBNL

CI codecov PyPI version Python Versions License Documentation Status

Open-source Python library for building energy analytics, serving as the analytical engine underlying the BETTER web application (Building Efficiency Targeting Tool for Energy Retrofits).

Features

  • Change-point Model Fitting: Automated fitting of 1P, 3P, and 5P change-point models for building energy analysis
  • Building Benchmarking: Statistical comparison of building performance against peer groups
  • Energy Savings Estimation: Weather-normalized savings calculations with uncertainty quantification
  • EE 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 demonstration
  • notebooks/explore.ipynb - Interactive exploration notebook
  • weather/ - Weather data integration examples

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Install development dependencies (uv pip install -e ".[dev]")
  4. Make your changes
  5. Run tests (pytest)
  6. Run linting (ruff check . && black . && mypy src)
  7. Commit your changes (git commit -m 'Add amazing feature')
  8. Push to the branch (git push origin feature/amazing-feature)
  9. 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 BSD license with additional 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

  • Author: Han Li (hanli@lbl.gov)
  • Project Manager: Carolyn Szum (cszum@lbl.gov)
  • Organization: Lawrence Berkeley National Laboratory

Acknowledgments

This work was supported by the U.S. Department of Energy's Building Technologies Office. BETTER is part of the DOE Building Data Tools ecosystem.

  • DOE Program Manager: Billierae Engelman
  • Cooperative Research and Development Agreement (CRADA) Partner: Johnson Controls, Inc. (benchmarking methodology and LEAN Energy Analysis)

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

better_lbnl_os-0.1.0.tar.gz (317.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

better_lbnl_os-0.1.0-py3-none-any.whl (296.5 kB view details)

Uploaded Python 3

File details

Details for the file better_lbnl_os-0.1.0.tar.gz.

File metadata

  • Download URL: better_lbnl_os-0.1.0.tar.gz
  • Upload date:
  • Size: 317.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for better_lbnl_os-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd19327d407387b099559be161505d174b32fb94ed59ea2682a130d1d106da3c
MD5 21798373c2e32f3483159ac3af5d6231
BLAKE2b-256 a03bd11e82f742448168d88351a5aadd9a5585b2548f1fc6a5b22378d1432d82

See more details on using hashes here.

File details

Details for the file better_lbnl_os-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: better_lbnl_os-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 296.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for better_lbnl_os-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 edacd5f648c3d103f1648eb3fc09199c051f10890e5e51d6a91109751ebad2d4
MD5 dcb48d65b31aee7606e39a6b4eba7243
BLAKE2b-256 1a6981436919be07cfae1af162702bb543f251091d2a3f9522d8cf88c5558c22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page