Skip to main content

Crate mako_emob

Crate mako_emob 

Source
Expand description

mako-emobNZR-EMob / Modell 2: the virtual Bilanzierungsgebiet that lets a driver bring their own supplier to a charge point.

A Ladepunktbetreiber (LPB/CPO) runs a regelzonenweites Bilanzierungsgebiet of its own, and every registered Übergabestelle’s flows are an exchange between the VNB’s BG and that one (Anlage 6 zum Beschluss BK6-20-160). The Marktlokation is then balanced in the LPB’s BG — „Modell 2“ — and the LPB assigns each charging session’s energy to the Bilanzkreis of the supplier the customer chose, quarter hour by quarter hour, with intraday supplier changes. BK6-24-267 extends the model to a private Kundenanlage under § 20 Abs. 1, 1a EnWG.

This crate is the allocation engine, its invariants, and the three UTILMD legs that move a Marktlokation between the models — pure domain: no I/O, no wire rendering, no persistence.

ModuleAnswers
bgmay this Bilanzierungsgebiet exist, here, now?
uebergabestellemay this Marktlokation enter Modell 2?
sessionwhat quarter-hour energies does this Ladevorgang produce?
allocationwho gets this quarter hour, and what is left over?
fristenwhen is each step due?
modellwechselwhich UTILMD leg moves it, and what does the answer carry?
wirewhich UTILMD qualifier carries it?
idswhich identifiers are ours to mint, and which are not?

The Entscheidungsbäume (E_0510E_0513) live in mako_pruefung::emob and the answer Fristen in mako_fristen::antwort, where every other market process keeps them.

§The one invariant everything else serves

Anlage 6 §IV.1 obliges the LPB to assign the whole Bilanzierungsgebiet, every quarter hour:

NGZ(t, richtung) = Σ zugeordnete Marktlokationen + Deltamenge

allocation::QuarterHourAllocation holds that exactly and returns a allocation::ConservationProof beside every row. The Deltamenge is a quantity, not a rounding error: it settles in a Bilanzkreis the LPB names, at the LPB’s own cost (§IV.2).

use mako_emob::allocation::{Anspruch, MaloKind, QuarterHourAllocation, Richtung};
use mako_emob::ids::VirtualMaloId;
use mako_emob::session::Viertelstunde;
use rust_decimal::dec;
use time::macros::datetime;

let slot = Viertelstunde::containing(datetime!(2026-11-03 08:07:00 UTC));

// 12 kWh crossed the Übergabestelle; two vehicles claim 9 of them.
let row = QuarterHourAllocation::allocate(
    slot,
    Richtung::Bezug,
    dec!(12),
    &[
        Anspruch { malo: VirtualMaloId::new("veh-1")?, kind: MaloKind::Vehicle, kwh: dec!(6) },
        Anspruch { malo: VirtualMaloId::new("veh-2")?, kind: MaloKind::Vehicle, kwh: dec!(3) },
    ],
)?;

assert_eq!(row.delta_kwh, dec!(3));   // the LPB's own Bilanzkreis carries these
assert!(row.proof.haelt());           // Anlage 6 §IV.1, checked

§The market role is NB

The BDEW Rollenmodell defines no LPB: „der LPB kommuniziert aus prozessualer Sicht wie die Rolle NB“ (AWH Kap. 1.4). Every message leaves as NB; mako_engine::marktrolle::Marktrolle::Lpb is a deployment identity, the Nmsb/Amsb pattern, without which the shared Prüfidentifikatoren are ambiguous in a deployment that is both VNB and LPB.

§Prüfidentifikatoren

PIDMessageFrom → ToAnswered by
55238Anmeldung in Modell 2NB (LPB) → NB (VNB)55239, E_0513E_0510
55240Beendigung der Zuordnung zur MaLoNB (VNB) → LF55241, E_0511
55242Abmeldung aus dem Modell 2NB (LPB) → NB (VNB)55243, E_0512
55235 / 55236Zuordnung / Beendigung ZP der NGZ zur NZRverantw. NB → benachb. NB, ÜNB55237, E_0102 / E_0103
55062 / 55063MaBiS-ZP für die tägliche BK-SZR eMobNB (LPB) ↔ ÜNB55064
13018MSCONS NetzgangzeitreiheNB (VNB) → NB (LPB), ÜNB
13003MSCONS NZR (eMob), BK-SZR (Kat. A) eMob, tägliche BK-SZR eMobNB ↔ NB, NB → BKV/ÜNB21001 / 21002 / 21004

§Sources

  • BK6-20-160 (21.12.2020) Anlage 6 „NZR-EMob“; Mitteilung Nr. 4 (03.05.2022)
  • BDEW AWH „Zum Modell 2 zur ladevorgangscharfen bilanziellen Energiemengenzuordnungsmöglichkeit“ V1.3 (01.04.2025)
  • BDEW AWH Ergänzung der Marktregeln … Bilanzkreisabrechnung (MaBiS) V1.0 (27.04.2022) — the Netzgangzeitreihe
  • BK6-24-267 (15.05.2025), bestandskräftig
  • UTILMD AHB Strom 2.2 Kap. 11; EBD 4.3 Kap. 17
  • MaBiS BK6-24-174 Anlage 3, Kap. 3.8 / 3.10 / 5

Re-exports§

pub use allocation::AllocationVersion;
pub use allocation::Anspruch;
pub use allocation::ConservationProof;
pub use allocation::MaloKind;
pub use allocation::QuarterHourAllocation;
pub use allocation::Richtung;
pub use allocation::Ueberdeckung;
pub use allocation::Versionsreihe;
pub use allocation::Zuordnung;
pub use bg::BgRegistry;
pub use bg::Regelzone;
pub use bg::VirtualBalancingArea;
pub use error::EmobError;
pub use ids::SessionId;
pub use ids::TokenRef;
pub use ids::VirtualMaloId;
pub use modellwechsel::EmobAbmeldungWorkflow;
pub use modellwechsel::EmobAnmeldungWorkflow;
pub use modellwechsel::EmobAntwort;
pub use modellwechsel::EmobZuordnungsendeWorkflow;
pub use modellwechsel::LegWire;
pub use modellwechsel::Modellwechseldaten;
pub use session::Ladevorgang;
pub use session::Provenance;
pub use session::SessionSplit;
pub use session::SlotEnergie;
pub use session::Viertelstunde;
pub use uebergabestelle::Abwicklungsmodell;
pub use uebergabestelle::AccessBasis;
pub use uebergabestelle::MeteringMode;
pub use uebergabestelle::Modellwechsel;
pub use uebergabestelle::Uebergabestelle;

Modules§

allocation
The conservation invariant — Anlage 6 §IV.1, executable.
bg
The LPB’s own Bilanzierungsgebiet — a regelzonenweites BG that exists only to hold charging energy.
error
What can go wrong forming a Modell-2 allocation.
fristen
The Modell-2 deadlines, in one place.
ids
The identifiers Modell 2 needs that the market does not issue.
modellwechsel
The three UTILMD legs that move a Marktlokation into and out of Modell 2.
session
Ladevorgänge, and how one becomes quarter-hour energies.
uebergabestelle
The Übergabestelle — one physical Marktlokation whose flows the VNB treats as an exchange with the LPB’s Bilanzierungsgebiet.
wire
The UTILMD qualifiers Modell 2 rides on, taken from the AHB rather than from prose.

Structs§

EmobModule
Engine module for NZR-EMob / Modell 2.

Enums§

Datenstatus
Datenstatus of one version of a Summenzeitreihe (Kap. 3.8.3).

Constants§

MODELLWECHSEL_PIDS
The Prüfidentifikatoren of the Modellwechsel, in process order.
ZP_NGZ_PIDS
The Prüfidentifikatoren of the Zuordnung des ZP der NGZ zur NZR.