Skip to main content

res-asset-kpi

tests docs License: MIT

Key performance indicators for operating PV plants, wind turbines and battery storage, and the contract logic around them: guaranteed values, exclusions and liquidated damages.

Asset managers, O&M contractors and lenders' engineers compute the same indicators for every portfolio: the performance ratio, availability as the contract defines it, the bridge from budget to actual production, power curves, failure rates, round-trip efficiency, cycles. This library writes them once, with explicit units, explicit time handling (UTC grids, local reporting periods, the DST hours) and a test against a hand-worked example for every formula. Its code comes from six open analysis projects and reproduces their results exactly (validation).

Documentation: https://kwwaleszczynski-del.github.io/res-asset-kpi/

What it covers

Asset Indicators
all long and wide input with a YAML mapping, explicit units, UTC grids for 5/10/15/30/60-minute data, the repeated and the skipped DST hour, local periods and contract years, data quality flags
PV performance ratio, PR corrected to 25 °C, weather-corrected PR; capacity-weighted time and energy availability with exclusions and a maintenance allowance; budget-to-actual energy bridge that closes exactly
Wind time and energy availability by IEC 61400-26 information category; power curve by the method of bins, AEP; MTBF and MTTR with confidence bounds, Crow-AMSAA, Laplace test
Battery round-trip efficiency corrected for the state of charge, with and without auxiliaries; LTSA availability; equivalent full cycles, rainflow; capacity tests with GUM uncertainty
Contracts guarantees, step-down, tolerance, damages, bonus and caps from YAML

Install

pip install res-asset-kpi

Python 3.11+; depends on numpy, pandas, scipy and PyYAML.

Examples

Performance ratio, plain and corrected to 25 °C cell temperature:

from res_asset_kpi import pv

t = pv.pr_terms(p_ac_kw=[48.0, 66.0], poa_wm2=[600.0, 900.0], p_stc_kw=100.0, interval_h=0.25,
                t_cell_c=[40.0, 55.0], gamma_per_k=-0.004)
t.pr, t.pr_temperature_corrected            # (0.76, 0.8407...)
\mathrm{PR} = \frac{\sum_i E_i}{\sum_i P_\mathrm{STC}\, G_i / G_\mathrm{STC}\, \Delta t}
\qquad
\mathrm{PR}_{25} = \frac{\sum_i E_i}{\sum_i P_\mathrm{STC}\, G_i / G_\mathrm{STC}\,\left[1 + \gamma\,(T_{c,i} - 25)\right] \Delta t}

A logger export in local time, with the autumn hour logged twice, onto a regular UTC grid:

import pandas as pd
from res_asset_kpi import schema

long = schema.read(pd.read_csv("export.csv"), "mapping.yaml")   # units converted, DST resolved
wide = schema.to_wide(long)                                      # index: interval start, UTC

Wind availability as an illustrative turbine warranty counts it, and the cost of calling grid stops faults:

from res_asset_kpi import wind

totals = wind.category_totals(categories, interval_h=1 / 6, lost_kwh=lost, actual_kwh=actual)
wind.availability(totals, "oem_warranty", allowance_h=60).time

Round-trip efficiency of a battery per month, corrected for the change of stored energy $\Delta E$ with the one-way efficiency $\eta$:

\mathrm{RTE} = \frac{E_\mathrm{out} + \eta\,\Delta E}{E_\mathrm{in}} \quad (\Delta E \ge 0),
\qquad
\mathrm{RTE} = \frac{E_\mathrm{out}}{E_\mathrm{in} + |\Delta E| / \eta} \quad (\Delta E < 0)
from res_asset_kpi import bess

monthly = bess.window_rte(site, "M", reference_energy=100.0, aux_metering="behind_meter")
monthly[["rte", "rte_excl_aux", "efc", "valid"]]

Two worked examples run on public data: NREL PVDAQ system 34 (examples/pvdaq_system34.py) and the Kelmarsh wind farm (examples/kelmarsh.py). The repository holds no data; the scripts read the files that the companion projects download.

Quality

  • Typed API (mypy strict), numpydoc docstrings whose examples run as doctests.
  • Hand-worked tests for every formula; property tests with Hypothesis (the energy bridge closes, availabilities stay in $[0, 1]$, rainflow preserves the path length, interval operations count every moment once).
  • Coverage above 90 %, CI on Python 3.11-3.13 and on the oldest supported dependencies.
  • validation/parity.py reproduces the source projects' results: 41 checks over about one million values, largest relative difference $1.3 \cdot 10^{-13}$.

Source projects

Project Contributed
pv-budget-bridge PR family, PV contract tests, energy bridge, input schema
pv-outage-classifier event treatments in PV availability
wind-downtime-availability IEC 61400-26 categories and availability
wind-power-curve-kelmarsh power curve binning, AEP
wind-om-reliability MTBF, MTTR, Crow-AMSAA, Laplace
bess-ops-warranty RTE, LTSA availability, cycles, capacity tests, damages

Citing

See CITATION.cff; releases are archived on Zenodo with a DOI.

License

MIT, see LICENSE.

Metadata

Release files for res-asset-kpi 0.1.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 res-asset-kpi 0.1.0
File Size Uploaded Provenance Actions
res_asset_kpi-0.1.0.tar.gz 80.0 kB With provenance Details for res_asset_kpi-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for res-asset-kpi 0.1.0
File Interpreter ABI Platform Actions
res_asset_kpi-0.1.0-py3-none-any.whl Python 3 none any Details for res_asset_kpi-0.1.0-py3-none-any.whl

Total release size: 152.6 kB

Release files / res_asset_kpi-0.1.0.tar.gz

Download URL res_asset_kpi-0.1.0.tar.gz
Size 80.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c5a7c3a5641dc0a485ba3ac8936ea6cd344711a857695243369e4bdf59aacdac
BLAKE2b-256 checksum
How to use checksums
1bf20bfdeb49ddbb0bfa13d286abf4b676af76a17a3bf4b8dc238c4ea35f3663
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 28, 2026.

Transparency log

Release files / res_asset_kpi-0.1.0-py3-none-any.whl

Download URL res_asset_kpi-0.1.0-py3-none-any.whl
Size 72.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fed81c843cd2e4cd46c95af2814ec8064332982d0a908bf9225e409e00ddbe8d
BLAKE2b-256 checksum
How to use checksums
1fe92454dc7078ad8cc9d12310121744162c92d918eeee707c21776451a1daee
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 28, 2026.

Transparency log

Security for res-asset-kpi 0.1.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

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

Select from 2 files

Attestation for res_asset_kpi-0.1.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 28, 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.

Release history Release notifications | RSS feed

This release

0.1.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