Skip to main content

ew-energy-models

Open, auditable energy-analytics models from Enerwyse.

ewmodels is a small Python library of energy models for commercial and industrial facilities. It covers load analytics, M&V baselines, and Ontario Global Adjustment / Industrial Conservation Initiative (ICI) peak tools.

Every model returns a result and an evidence receipt. The receipt records:

  • the input data hash
  • the detected interval resolution
  • data-sufficiency checks, each pass/fail
  • the simplifying assumptions the result relies on
  • the code version that produced it

A number without its receipt is not a result.

from ewmodels.data.ieso import fetch_demand
from ewmodels.ontario import atlas, ici

demand = fetch_demand(range(2022, 2027))["ontario_demand_mw"]
res = atlas.peak_atlas(demand)

print(res.value["summary"])        # per base period: 5th-peak threshold, crowding
print(res.receipt.summary())       # what this number rests on

Why this exists

Energy analytics usually comes as a black box: a vendor's number on a dashboard. Facility managers, M&V reviewers and incentive programs then have to take it on trust. We think the math should be open and every figure should be checkable. The value a platform adds is applying the math reliably to real operations, not hiding it.

What's in v0.2: Ontario ICI toolkit

Module What it does
ewmodels.data.ieso Downloads and parses IESO hourly Ontario demand and the ICI Demand reports. Converts hour-ending EST to interval-start timestamps. Caches locally.
ewmodels.data.ieso_forecast Parses IESO's Ontario demand forecasts (Adequacy3) and keeps an open forecast archive
ewmodels.ontario.ici Base periods, top-5 peak hours, Peak Demand Factor from interval meter data, GA charge, an optional clean-energy PPA offset, and curtailment-savings simulation
ewmodels.ontario.atlas Ontario Peak Atlas: per-season thresholds, peak timing, and crowding, i.e. how many days came within 1–5% of the 5th peak
ewmodels.ontario.benchmark Open 5CP benchmark: replays history day by day with no look-ahead and scores any peak-calling strategy on peaks captured vs. days curtailed. Supports synthetic or real forecasts, hour-level scoring with a curtailment window, window-length analysis, and a growth-removed stress test

The open 5CP benchmark

Accuracy scores don't capture what a Class A customer actually trades off. A strategy that calls every hot weekday catches every peak and disrupts operations all summer. One that calls three days may miss the peak that mattered. The benchmark gives a strategy only what was knowable before each day, then scores it in operational terms:

from ewmodels.ontario import benchmark

result = benchmark.evaluate(demand, benchmark.threshold_strategy(margin=0.03),
                            forecast_error_pct=2.0)
print(result.value)   # per base period: days_called, peak_hours_captured, capture_rate

Any function DayContext -> bool is a strategy, so you can plug in your own forecaster and compare it on the same terms.

Two honesty guards are built in:

  • Stress test. Ontario's peak has grown every recent season, which flatters any rule anchored on last year's peaks. normalize_seasons() removes that growth, so a strategy has to work in a flat year too.
  • Real windows. All five peak hours usually fall on one afternoon, as consecutive hours. window=(start, hours) scores what a fixed curtailment window actually catches, and window_coverage() shows how long the window has to be.

The open IESO forecast archive

IESO keeps its Ontario demand forecasts for only about 90 days, so no public record exists of what was forecast against what happened. This repo builds one: a scheduled workflow snapshots IESO's forecasts twice a day into data/ieso_forecast_archive.csv. Once a full ICI season is archived, the benchmark can score strategies on the forecasts operators actually saw.

Design principles

  1. Receipts, not just results. Checks fail loudly: for example, a missing meter reading during a peak hour makes the PDF receipt invalid, rather than silently computing a wrong PDF.
  2. Resolution is data, not configuration. Utility interval data arrives at 5, 15 or 60 minutes. Models detect the resolution and never assume it.
  3. Deterministic and reproducible. The same inputs always give the same outputs, and randomness is seeded.
  4. No customer data, ever. The library ships no meter data. Examples use public sources only (IESO, Environment Canada, open building datasets).

Roadmap

The library will grow to cover the Enerwyse models catalogue:

  • v0.3 Load kernels: load-profile decomposition, peak ranking, load factor
  • v0.4 M&V: ASHRAE Guideline 14 change-point baselines (3P/4P/5P), weather normalization, CUSUM tracking, with CV(RMSE)/NMBE validity in the receipt
  • Later: day-ahead load forecasting, load-shifting optimization, and carbon-intensity scheduling

Install

pip install ew-energy-models            # once published
# or from source
pip install -e ".[dev]" && pytest

Important

This is an analysis tool, not a settlement engine. Peak hours reproduced from public demand data are provisional until the IESO publishes the official ones. PDFs computed with Ontario Demand as the denominator are estimates. Your LDC or IESO invoice is authoritative. Nothing here is financial or regulatory advice.

Maintenance

See MAINTENANCE.md for the runbook: weekly checks, alerts, yearly updates, releases.

License & citation

Apache-2.0. If you use this in research, please cite it (see CITATION.cff). IESO data © Independent Electricity System Operator. It is fetched at runtime, not redistributed.

Metadata

Release files for ew-energy-models 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ew-energy-models 0.2.0
File Size Uploaded Provenance
ew_energy_models-0.2.0.tar.gz 67.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ew-energy-models 0.2.0
File Interpreter ABI Platform
ew_energy_models-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 96.5 kB

Release files / ew_energy_models-0.2.0.tar.gz

Download URL ew_energy_models-0.2.0.tar.gz
Size 67.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7f0903381d04769f4bb8632a1b0c714d10575130864248d6c021e5d92917ff90
BLAKE2b-256 checksum
How to use checksums
8f9102c00a774cf69b755d39d096245248698d5353a8fbe4cdded5a84c1cc176
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / ew_energy_models-0.2.0-py3-none-any.whl

Download URL ew_energy_models-0.2.0-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ba7979297edc7f87c39bb3bfdeab9b96441739284108748e927cbb000d5aef0
BLAKE2b-256 checksum
How to use checksums
6cb1ad72a8aa12d40034adf8580afa177b5a51b3d79ed0a7328342a13b35b965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for ew-energy-models 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ew_energy_models-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page