metering
The open, checkable reference for German energy-metering quantities, in Rust. Every number traces to a published clause — MsbG, EnWG, EEG, HeizkostenV, the BNetzA Festlegungen, the EDI@Energy documents — and every quoted passage is checked against the PDF it comes from.
A pure library — no I/O, no async, no clock. Quantities are exact Decimals,
every rounding names its places and mode, and time is Europe/Berlin: a day of
23, 24 or 25 hours, a Gastag from 06:00. It computes kWh, m³ and kW, not money.
Guides · API reference · Changelog
Install
The serde feature enables serde and time/serde; see
Design for the
representation. MSRV 1.88 (edition 2024), tested in CI; raising it is a
minor-version bump while 0.x.
Quick start
A day of quarter-hours with one value missing: validate, substitute, aggregate.
use *;
use Bundesland;
use SubstitutionReason;
use Grade;
use ;
examples/pipeline.rs runs the whole chain — readings,
validation, substitution, aggregation, tariff registers — on the 25-hour autumn
day: cargo run --example pipeline.
What's in it
| Group | Modules | Guide |
|---|---|---|
| Series, time, IDs | series (intervals, Series, readings, resampling), time (DayBoundary, Period, holidays), ids (MaLo, MeLo, EIC, BDEW codes, OBIS) |
Time · Series and readings · Identifiers |
| VEE | vee — validation, grading, Ersatzwertbildung with MSCONS codes |
Validation and substitution |
| Billing | billing — Arbeitsmenge, Spitzenleistung, tariff registers and § 14a Modul 3, Blindmehrarbeit, Mehr-/Mindermengen, losses, forecast |
Billing quantities |
| SLP | slp — BDEW SLP Strom, SigLinDe SLP Gas |
Gas and units |
| Gas | gas — m³ → kWh_Hs, Zustandszahl (DVGW G 685) |
Gas and units |
| Heat | heat — HeizkostenV § 6a, § 9, § 9a |
Heat |
| Grid | grid — § 14a EnWG, Redispatch Ausfallarbeit, EN 50160, rollout |
Grid · Power quality |
| Allocation | allocation — UTILTS Berechnungsformel, § 42b community, § 42c sharing, sessions |
Allocation |
| EEG | eeg — MiSpeL (adopted 01.10.2026), EEG § 51/§ 51a, EnFG § 46 |
EEG and EnFG |
Scope
| Not here | Why | Where instead |
|---|---|---|
| Money — prices, Netzentgelte, Umlagen, invoices | the output is kWh, m³ and kW | your billing layer |
| EDIFACT / XML market messages | parsing a MSCONS or UTILTS is not arithmetic | mako |
| Fristen — counting Werktage to a deadline | a process-engine concern; the holiday calendar here serves SLP day types and tariff registers | your process engine |
| SMGW certificates, device inventory | PKI and asset tracking, not quantities | your device management |
The regulatory basis lists every source and the version in force. Nothing here is legal advice.
Testing
The Rust blocks in this README and on the guide pages run as doctests.
just quotes needs pdftotext and the fetched corpus; it is not a CI job.
Contributing and license
Issues and pull requests welcome; a change to a regulated calculation cites the provision it implements. Licensed under Apache-2.0 or MIT at your option.