Expand description
Charging sessions: how they were authorised, what the meter said, and how that divides across the quarter hours the market settles in.
§What is here
auth— the five paths a session can be authorised by, and why they are not interchangeable: AFIR requires a contract-free one at every public point, and the signed record states how strongly the driver was identified.meter— cumulative register readings with the reason each was taken.Sample.Clockis the one that can settle a quarter hour without guessing.split— the quarter-hour split, which conserves energy exactly by construction and records for every slot whether it was measured or interpolated.mispel— the first arithmetic larger than one session: a bidirectional site’s month (and Pauschal year) under the Bundesnetzagentur’sMiSpeLFestlegung, netting the points’ quarter hours against the grid meter’s.successandreliability— the charging success rate per day, and the month report a second reader can recompute and the public can read.session— the session itself, as a state machine that refuses what the protocol forbids and keeps when each state was entered, because “suspended” is an interval a tariff prices rather than a status light.
§The one idea worth reading about
Splitting a session across quarter hours naively — computing each slot
independently — leaves a sum that is a few milliwatt-hours off the total,
and the usual fix shoves the difference into the last slot, misattributing
energy to whoever held it. Instead split::into_quarter_hours computes
the cumulative value at each boundary once and takes differences, so the
sum telescopes and equals the total to the last digit, always:
use emob_session::{MeterReading, MeterSeries, ReadingContext, split};
use emob_core::{Direction, Energy};
use rust_decimal::Decimal;
use std::str::FromStr;
use time::macros::datetime;
// 10:01 to 10:22 — the boundary at 10:15 falls two thirds of the way through,
// and 7 kWh times two thirds does not terminate.
let series = MeterSeries::new(Direction::Import, vec![
MeterReading::new(datetime!(2026-01-02 10:01 +1), kwh("0"), Direction::Import, ReadingContext::TransactionBegin),
MeterReading::new(datetime!(2026-01-02 10:22 +1), kwh("7"), Direction::Import, ReadingContext::TransactionEnd),
])?;
let split = split::into_quarter_hours(&series)?;
assert!(split.conserves()); // exactly 7 kWh, across two slots
assert!(!split.fully_measured()); // …and it says it had to interpolate§No I/O, no clock
Nothing here reads a clock, a socket or a file. Every instant is an argument, so a session from two years ago splits today exactly as it split then.
Re-exports§
pub use auth::AuthError;pub use auth::AuthPath;pub use auth::Authorization;pub use auth::Subject;pub use auth::TokenRef;pub use meter::MeterError;pub use meter::MeterReading;pub use meter::MeterSeries;pub use meter::ReadingContext;pub use session::EndReason;pub use session::Session;pub use session::SessionError;pub use session::SessionState;pub use session::StateChange;pub use split::Idle;pub use split::Provenance;pub use split::SessionSplit;pub use split::Slot;pub use split::SplitError;
Modules§
- auth
- How a charging session was authorised.
- meter
- The meter readings a session leaves behind, and where each one came from.
- mispel
- The
MiSpeLmonth: how much of a bidirectional charging site’s grid draw is relieved of levies, under the Bundesnetzagentur’s Festlegung 618-25-02 of 01.10.2026. - reliability
- The month report: the charging success rate of one local calendar month, with everything a second reader needs to recompute it (spec 018).
- session
- The session itself, and the states it may legally be in.
- split
- Splitting a session across quarter hours, exactly.
- success
- The charging success rate: sessions that reached a billable record over sessions attempted, per charge point and for the estate.
Structs§
- Quarter
Hour - Fifteen minutes of real time, starting at an instant on a quarter-hour boundary.