Skip to content

Documentation

PyNRPF (Python for Network Reverse Power Flow) detects and corrects a wrong reverse power flow (RPF) sign in fifteen-minute substation net-load data.

When rooftop solar exceeds local demand a substation exports, and net load is genuinely negative. Some meters store that export as an import: the recorded trace dips towards zero instead of crossing it. The reading passes ordinary validation but is wrong by twice its value, and it corrupts every minimum-demand study and net-load forecast built on it.

The method, M9, asks one physical question of every day: for which daytime window would flipping the recorded sign make the implied demand more plausible, how strong is that evidence, and is it strong enough to act on? It needs no training, gives every day a calibrated probability, and applies one control: correct automatically, keep automatically, or send the day to a person.

Install

python -m pip install pynrpf==0.4.0

Python 3.10 or later; numpy and pandas are the only dependencies. Install covers the extras and the two pinned routes on Databricks.

Three ways to run it

import pynrpf
result = pynrpf.run(frame)                 # a pandas frame of readings
result.site_days, result.intervals, result.provenance
from pynrpf.spark import run_per_site      # a Spark frame, one site at a time
site_days, intervals = run_per_site(sdf)
pynrpf run readings.csv --out results/     # a CSV, no code
Show details

Where things are

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

page what it covers
Install pip, the extras, Databricks, reproducibility
Quick start one call, and the two output tables column by column
Spark the per-site adapter and what the calling pipeline owns
Command line pynrpf run
API every public name
Method the nine steps of M9, with the formulas and a worked day
Calibration the release numbers, and refitting for a new population
Overrides the review-table schema for human decisions
Papers the conference paper, the journal article in preparation, how to cite
Data the Alpha, Beta and Gamma datasets and how they were labelled
Evaluation how the paper judges a method
Reproduce the paper the notebooks that regenerate every figure and table
Development tests, lint, continuous integration, releases

The journal paper's code, data and results live under publication/2_journal_article/; the conference paper's archive under publication/1_conference_paper/.