Skip to main content

res-asset-kpi

tests docs PyPI DOI 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; a regression check against their original code, before they switched to the library, reproduces their results (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 compares the library with the original code of the source projects, pinned to the commits before they imported it: 41 checks over about one million values, largest relative difference $1.3 \cdot 10^{-13}$. A regression check of the extraction, not an independent validation of the methods.

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

Used by

These projects install the library from PyPI and compute their indicators with it. The switch left every figure in their READMEs unchanged.

Project Uses
pv-budget-bridge pv.pr_terms, pv.availability, pv.shapley_product, contracts.assess
wind-downtime-availability wind.category_totals, wind.availability
wind-power-curve-kelmarsh wind.air_density, wind.bin_power_curve, wind.aep_rayleigh
wind-om-reliability wind.operating_time, wind.mtbf_mttr, wind.crow_amsaa, intervals
bess-ops-warranty bess.interval_flows, bess.corrected_rte, bess.ltsa_availability, bess.rainflow, bess.evaluate_capacity_test, contracts.damages_amount

Citing

Please cite the software through its Zenodo DOI, 10.5281/zenodo.23742958 (all versions; each release also has its own DOI, e.g. 0.1.0: 10.5281/zenodo.23742959). See also CITATION.cff.

License

MIT, see LICENSE.

Metadata

Release files for res-asset-kpi 0.1.1

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.1
File Size Uploaded Provenance Actions
res_asset_kpi-0.1.1.tar.gz 87.9 kB With provenance Details for res_asset_kpi-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 163.9 kB

Release files / res_asset_kpi-0.1.1.tar.gz

Download URL res_asset_kpi-0.1.1.tar.gz
Size 87.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6b991695b6c7fd7789ad2f221d8956dca3ddd30572efa86b9b01d7b5799a0492
BLAKE2b-256 checksum
How to use checksums
2813bffa3cdee8bd26e51c6c6abe842ad3b07c43cf704a21c03e2ba0ce6f3a6e
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 Nov 13, 2026.

Transparency log

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

Download URL res_asset_kpi-0.1.1-py3-none-any.whl
Size 76.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d53b0034b5661f7e9da364b9f4a0c9cec200b0ec8f07b7b83b3043d4c7a2e011
BLAKE2b-256 checksum
How to use checksums
45b94c6a1e3c6049918c93b05ce8b2b9db24e4bd7c1f286fbc30b65e3865690c
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 Nov 13, 2026.

Transparency log

Security for res-asset-kpi 0.1.1

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.1.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 Nov 13, 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