Skip to content

Documentation

Python for Network: Tariff to Load Profile (PyNTLP) turns a tariff's assumptions into a change to an existing load forecast. The pyntlp package implements one tariff, the Solar Sharer Offer (SSO): it moves a share of each baseline profile's daily energy into the tariff's free window and takes the same energy out of donor intervals, and returns the change as additive interval deltas.

post_sso_demand_mw = baseline_demand_mw + delta_mw

The package is a library of Spark transformations. The caller owns all data access, table names and orchestration, and passes in already-normalised Spark DataFrames.

Install

Python 3.12, PySpark 4.x, and Java 17 for Spark. The package is installed from GitHub:

python -m pip install "pyntlp @ git+https://github.com/mssamhan31/PyNTLP@v0.2.0"

Four calls

from pyntlp import (build_lga_segment_metrics, compute_pma_sso,
                    load_params, validate_pma)

params = load_params("params.yaml")
metrics = build_lga_segment_metrics(lga_segment_attributes_df, smart_meter_df, params)
pma_delta_df = compute_pma_sso(baseline_profiles_df, metrics, params)
report = validate_pma(pma_delta_df, params)

The Usage guide walks through each call; the Model overview explains what the model computes.

Show details

Where things are

Every page of the documentation, including those not in the menu.

page what it covers
Usage guide the six steps from parameters to a post-SSO profile
Model overview the delta calculation, model grain, eligibility, participant cap, debugging
API contracts every public function, required column, parameter key and output column
Troubleshooting common symptoms, likely causes and what to check
Papers the AQF conference paper, the journal article in preparation, how to cite
Assumptions and limitations what the model assumes and does not claim
Glossary tariff, load-profile and package terms
Repo structure the files and folders of the repository
Development local setup, tests, Spark, documentation, review checklist
AQF Adaptive Quantile Flexibility, a separate study, and where its code lives

Reading order for a new user

  1. Glossary, for the terms used throughout.
  2. Assumptions and limitations, for what the model does and does not claim.
  3. Usage guide, for the normal workflow.
  4. Model overview, for the calculation in detail.
  5. API contracts, when preparing inputs or reading outputs.

Use the usage guide and model overview to understand the model; use the API contracts and development pages when changing code, writing wrappers or reviewing behaviour.

What the documentation leaves out

The documentation avoids production table names, Databricks widgets and environment-specific deployment instructions. Those belong in wrapper notebooks or operational documentation outside this reusable package.

Research code

Research code for papers lives under publication/ in the repository and is not imported by the package. The AQF conference paper's code is in publication/1_conference/; see AQF.