Skip to main content

Synthetic smart building simulation toolkit with CLI workflows

Project description

Docs License: MIT PyPI version DOI

Python Code Style: Ruff Type Checked: mypy Tests: pytest PyPI Downloads

SmartBuildSim

SmartBuildSim is a deterministic smart-building simulation toolkit. It provides utilities for loading BIM-style building schemas, generating synthetic sensor data, engineering features, training forecasting/anomaly/clustering/RL models, and producing Matplotlib visualisations. A Typer-powered CLI orchestrates the full workflow using YAML configuration files.

Features

  • Deterministic synthetic data – centrally managed via smartbuildsim.config with repeatable random seeds.
  • Rich modelling suite – forecasting (linear regression with lagged features), anomaly detection (IsolationForest), clustering (k-means) and reinforcement learning (tabular Q-learning).
  • Scenario presets – ready-to-run building layouts with tuned defaults.
  • Matplotlib visualisations – overlay anomalies and cluster assignments on sensor time series plots.
  • Typer CLI – declarative YAML configs with dotted overrides and sensible output management.

Quickstart

  1. Install dependencies (Python 3.10+):

    pip install -e .
    
  2. Generate a default BIM schema:

    smartbuildsim bim init examples/outputs/schema.yaml --scenario office-small
    
  3. Create synthetic data, train models, detect anomalies, cluster zones, train RL policy, and plot results using the bundled configuration:

    smartbuildsim data generate examples/configs/default.yaml
    smartbuildsim model forecast examples/configs/default.yaml
    smartbuildsim model anomalies examples/configs/default.yaml
    smartbuildsim cluster run examples/configs/default.yaml
    smartbuildsim rl train examples/configs/default.yaml
    smartbuildsim viz plot examples/configs/default.yaml \
      --anomalies-path outputs/anomalies.csv --clusters-path outputs/clusters.csv
    
  4. Run the end-to-end Python example:

    python examples/scripts/run_example.py
    
  5. Explore the interactive workflow notebook located at examples/notebooks/smartbuildsim_workflow.ipynb for a cell-by-cell walkthrough of the same pipeline. Launch it with your preferred Jupyter interface (e.g. jupyter lab examples/notebooks).

Configuration Overview

Configuration is supplied via YAML documents. The examples/configs/default.yaml file demonstrates the expected structure:

scenario: office-small
determinism:
  seed: 123
paths:
  output_dir: ./outputs
  dataset: ./outputs/dataset.csv
data:
  days: 10
  seed: 123
models:
  forecasting:
    horizon: 2
  anomaly:
    contamination: 0.07
cluster:
  sensors:
    - cluster_energy
    - cluster_co2
viz:
  sensor: office_energy

Override any configuration entry directly from the CLI using dotted keys:

smartbuildsim data generate examples/configs/default.yaml \
  --override data.seed=999 --override data.days=5

See Deterministic execution for component specific seed overrides that integrate with the CLI.

Reproducibility

Run ./reproduce.sh to execute the default CLI pipeline twice and assert that the generated datasets are identical. This lightweight check is useful both for local development and as a CI smoke test.

Development

Install the project in editable mode and run the quality gates:

pip install -e .[dev]
ruff check .
mypy .
pytest

Post-generation Checklist

  • Deterministic data generation with scenario presets
  • Forecasting, anomaly detection, clustering, and RL modules
  • Matplotlib-based visualisations
  • Typer CLI with overrides and persisted outputs
  • Comprehensive tests and CI configuration

License

This project is licensed under the MIT License.

With Passion: dr Tymoteusz Miller

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

smartbuildsim-0.2.0.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

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

smartbuildsim-0.2.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

Details for the file smartbuildsim-0.2.0.tar.gz.

File metadata

  • Download URL: smartbuildsim-0.2.0.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for smartbuildsim-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a2e0517f95f9336a56fcd3c8f8350a6356e58d63570a4e6c4edb4734d95a34c3
MD5 fd3ada3d16367e85f05887f251882068
BLAKE2b-256 06e66104dd4cbaeebd01c018c79ea790c06fa03579c4fefadc42bd83718cd822

See more details on using hashes here.

File details

Details for the file smartbuildsim-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: smartbuildsim-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for smartbuildsim-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc35a00014b4f87bb1946cf8131a648ec7931ebece8ab6df40d152287152966f
MD5 40b8fc9890da89af015997836589a3e7
BLAKE2b-256 bfd7f3e8c43c10eef99bdcfbf1675100b1a4ff9fd1f0d78c876c3218634e094c

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