Skip to main content

loadcast

PyPI version Documentation Status Build Status License DOI

A parametric generator of hourly industrial energy demand, for comparing technologies on a common demand, parametric and sensitivity analyses, and uncertainty propagation.

loadcast generates a year of heat, cold and electricity demand for an industrial site from a few numbers an engineer can get from a site visit or an energy bill. The annual energy and the load factor (mean demand over peak demand) of each carrier match the request exactly; its spread and persistence (how long a high or low spell lasts) land near their targets. The relationship between carriers is an input too: how tightly they move together, and how many hours apart they are offset. A year takes about a second.

import loadcast

profiles = loadcast.generate(
    annual_mwh=10_000,
    heat_to_cold=7.4,        # this site wants 7.4 times more heat than cold
    elec_share=0.20,         # a fifth of its energy is electricity
    process_class="semi_continuous",   # weekday shifts, weekend trough
    carrier_correlation=0.75,          # how tightly the carriers move together
    carrier_lag_h={"cold": 6},         # cold demand trails heat by six hours
)

profiles is a DataFrame with one row per time step (8760 for an hourly year, 35 040 for a quarter-hourly one) and the columns heat_kw, cold_kw, elec_kw and waste_kw, the last zero unless you ask for waste heat.

Heat-cold cross-correlogram: the published disaggregated construction peaks at exactly 1.000; loadcast peaks at the 0.60 asked for

Correlation between heat and cold demand at each offset in hours. Left: every carrier as a fixed multiple of one shared profile, the construction behind published disaggregated data, which correlates them at 1 by algebra. Right: loadcast with carrier_correlation=0.60. More in the tutorial notebook.

What it is for

Use it when a design study needs the hourly demand of an industrial site and has no metered series. You are sizing something that serves the site's heat, cold or electricity: a heat pump, a thermal store, a trigeneration unit. Metered industrial series are rarely published, so each study builds its demand from whatever it can obtain: one metered plant, a sector average, a standard load profile. Studies of different technologies then rarely rest on the same demand, and their results are hard to compare.

Because a handful of numbers defines the demand, loadcast does three things a borrowed series cannot:

  • Give studies a common demand. A study that reports its inputs and random seed lets anyone regenerate its demand. A heat pump, a thermal store and a trigeneration unit can then be assessed against the same site, or against the same range of sites.
  • Sweep what no dataset measures. Whether a site wants its carriers at the same hours decides how much storage it needs, and no public dataset resolves it. Here it is two inputs, carrier_correlation and carrier_lag_h, to vary like any other.
  • Propagate uncertainty. Every input is a single number, so the generator suits parametric analyses, sensitivity analysis and uncertainty propagation.

It is not a model of your site. The inputs are yours to choose, and the defaults are indicative values with a stated source, not predictions. Report a conclusion as it holds across a range of inputs, not at one assumed point.

Why the coupling between carriers is an input

A store exists to bridge the hours when a site wants one carrier and not another. Sizing it therefore needs more than how much of each carrier the site uses: it needs to know whether the site wants them at the same hours. No existing source lets a user set that:

source approach industrial coupling between carriers settable?
demandlib / BDEW SLP deterministic step profiles yes no: every carrier follows the same calendar
RAMP bottom-up from appliances no no: it follows from user schedules
LoadProfileGenerator behavioural simulation no no
EnTiSe framework, pluggable methods partly no: a dependency between pipeline steps
JERICHO-E-usage disaggregated national totals yes no: fixed at exactly 1

Published disaggregated datasets build each carrier as a fixed multiple of one shared profile, $P_m(t) = \kappa_m,p(t)$, where $P_m(t)$ is the demand for carrier $m$ at hour $t$, $p(t)$ the shared profile and $\kappa_m$ a constant. Under that construction the correlation between any two carriers is exactly 1: an artefact of the method, not a measurement. A storage study fed with such data has its answer built into its input.

What you specify

Inputs you can answer from a site visit or an energy bill:

input meaning
annual_mwh total annual energy across all carriers, as delivered to the process
heat_to_cold ratio of annual heat to annual cold
elec_share electricity as a fraction of the total
process_class how the process runs: continuously, in shifts, in campaigns or in batches
carrier_correlation how tightly the carriers move together, once lined up at their best match
carrier_lag_h hours by which a carrier trails the others
rated_kw the most each carrier can draw, kW: its cap
load_factor or each carrier's mean over peak demand, which sets the same cap
calendars a calendar of its own for a carrier that keeps other hours
seed random seed: the same inputs and seed give the same profiles

Every energy is delivered: the heat and cold the process receives, and the electricity it uses for everything else, not the fuel and electricity on the bill. The choosing inputs page shows how to convert a bill. Where the site cannot answer, it gives published values by sector, temperatures included, each with its source and its limits. It is a guide: a sector average cannot place a single site.

A process class is a rhythm calibrated on a metered industrial site: a calendar of how demand varies by month and by hour of the week, plus a load factor, a spread and a persistence. A shipped class gives a decent first result with nothing to tune. When you know your site differs, change what you know and keep the rest:

from loadcast import Calendar, custom_class

shifts = Calendar.from_schedule([("Mon-Fri", 6, 22), ("Sat", 6, 14)],
                                base_load=0.25, monthly_energy=bills_mwh)
plant = custom_class("semi_continuous", calendar=shifts, off_fraction=0.1)

profiles = loadcast.generate(
    annual_mwh=10_000, heat_to_cold=2.2, elec_share=0.21,
    process_class=plant,                       # no registering needed
    rated_kw={"heat": 1300, "elec": 450},      # each carrier's peak, kW
    calendars={"cold": Calendar.flat()},       # cold rooms run all week
)

The calendar comes from your shift schedule, a week of metering or twelve monthly bills. The class keeps its fluctuation within the running hours and adapts its spread and load factor to the change. If you measured the load factor, the spread (cv, standard deviation over mean) and the persistence (lag1, the correlation with itself one hour later), class_from_observations builds a class from them directly. Closed-form formulas turn the statistics into the generator's parameters, with no fitting; the mathematics page derives them, and the usage page shows each change.

What it guarantees exactly

To floating-point precision:

  • the annual energy equals annual_mwh;
  • the heat-to-cold ratio equals heat_to_cold, and the electricity share elec_share;
  • the load factor equals the class's, or a rated carrier's mean demand over its rating, because a cap on the peak holds it -- as long as the profile reaches the cap;
  • no carrier exceeds its rating;
  • every value is strictly positive.

Spread and persistence are aimed at, not imposed. The on/off states and the cap act after them, so they land near their targets, with a bias the mathematics page reports for each class.

Whatever cannot be delivered as asked draws a TargetMissedWarning that says why: a rating above the profile's own peaks, a correlation below the floor the calendar sets, a spread smaller than the calendar already makes. loadcast.delivery_report(spec, profiles) gives the full comparison as a table. The shipped classes at their defaults never warn.

Diagnostics

loadcast.summary_table(profiles)                       # the four statistics
loadcast.duration_curve(profiles["heat_kw"])           # load duration curve
loadcast.cross_correlogram(profiles["heat_kw"], profiles["cold_kw"])
loadcast.integrated_drift(profiles["heat_kw"], profiles["cold_kw"], window_h=24)

The cross-correlogram gives the correlation between two carriers at each offset in hours. Read where it peaks, not only how high. Offsetting two carriers lowers their correlation at zero offset towards a floor set by their shared calendar, which is where a weak coupling would put it too: at zero offset, a lag and a weak coupling look the same.

The integrated drift is what a store responds to. A store does not see the mismatch between two carriers hour by hour; it accumulates it. What sizes it is therefore the mismatch summed over the storage window, and the correlation is only one point of that picture.

Sweeps and uncertainty

A year of demand takes about a second, so the uncertain inputs of a site can be sampled rather than argued. For a semi-continuous food plant whose heat-to-cold ratio, electricity share, coupling and lag between carriers are all uncertain:

from scipy.stats import qmc        # scipy is not a loadcast dependency

samples = qmc.scale(qmc.Sobol(d=4, seed=1).random(32),
                    [1.0, 0.14, 0.45, 0.0], [3.4, 0.28, 0.90, 12.0])
years = [loadcast.generate(annual_mwh=10_000, heat_to_cold=k, elec_share=e,
                           process_class="semi_continuous", carrier_correlation=r,
                           carrier_lag_h={"cold": int(round(lag))}, seed=1)
         for k, e, r, lag in samples]

Feed each year to your design model, and fit a polynomial chaos expansion to its outputs to rank the inputs. Keep the same seed in every sample: the uncertainty page shows why, where each range comes from, and what to check before reading the result.

What it deliberately does not do

  • No temperature. It carries energy by carrier. Whether a machine can reach a process's temperature is a separate question, answered from the machine's own limits. The choosing inputs page points to published process and waste heat temperatures by sector.
  • No validated cold shape. No site in the calibration archive meters refrigeration. The cold carrier's annual quantity is whatever you specify, but its hourly shape rests on the same calendar and coupling as the other carriers, and nothing independent confirms it. Every cold result carries this caveat.

Install

pip install loadcast

Requires Python 3.9+, numpy and pandas. Nothing else.

Documentation

The documentation has six parts:

  • Usage: from the one-liner to a class built from your own measurements, and how to check what you got.
  • Choosing inputs: how to read the inputs off an energy bill, and published values by sector, temperatures included, for when the site cannot answer.
  • Sweeps and uncertainty: one input at a time, sampled inputs, and which inputs matter.
  • Examples: the figures of the tutorial notebook, each with what it shows.
  • Mathematics: every formula derived, with worked numbers and every symbol defined.
  • API reference: every public function and class.

The examples/ folder holds the tutorial notebook and a sampled food plant.

Calibration data

The process classes are calibrated on metered industrial sites that cannot be redistributed. What ships is derived statistics and calendar factors: group means that carry no identifying information. The raw series are not part of this repository.

Sister project

Does your study need hourly electricity prices as well as demand? pricecast, by the same authors, turns hourly load, solar and wind generation into a year of hourly day-ahead prices, with future years built from ENTSO-E's TYNDP scenarios. It follows the same idea: a few stated inputs give a year of hourly data, fast enough to sweep and to sample.

Citing

Use the "Cite this repository" button or CITATION.cff. Every release is archived on Zenodo: 10.5281/zenodo.22961300.

Contributing

Issues and pull requests are welcome; see CONTRIBUTING.md for the scope, what a test looks like here, and what support to expect. Reports of generated profiles that disagree with a site you have measured are especially useful: the calibration archive is small, and that is the package's main limitation. This project follows the Contributor Covenant. Generative AI was used in building it; see AI_USAGE.md.

Licence

MIT; see LICENSE. Changes are recorded in CHANGELOG.md.

Metadata

Release files for loadcast 1.0.3

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

Source distribution (sdist)

Source distribution for loadcast 1.0.3
File Size Uploaded Provenance Actions
loadcast-1.0.3.tar.gz 3.4 MB With provenance Details for loadcast-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for loadcast 1.0.3
File Interpreter ABI Platform Actions
loadcast-1.0.3-py3-none-any.whl Python 3 none any Details for loadcast-1.0.3-py3-none-any.whl

Total release size: 3.5 MB

Release files / loadcast-1.0.3.tar.gz

Download URL loadcast-1.0.3.tar.gz
Size 3.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c64463926420b50c3388b12ea8fdcdbd9d6d8b2a89c3a215327ecf30cd5318fc
BLAKE2b-256 checksum
How to use checksums
2422ca1426cc6c5a8d5cd7ae3d363f5385aceacf7436299ffc3f705bce589263
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 24, 2026.

Transparency log

Release files / loadcast-1.0.3-py3-none-any.whl

Download URL loadcast-1.0.3-py3-none-any.whl
Size 54.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25508602df04b079832773875640ba5b7ac686f2bea95d1c6a7070edb880a684
BLAKE2b-256 checksum
How to use checksums
d796cd17965b0327172721db2e4d071a6dc224763e91ead5fb50f8706cfb03cf
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 24, 2026.

Transparency log

Security for loadcast 1.0.3

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for loadcast-1.0.3.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 24, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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