Skip to main content

Crate dvgw_edi

Crate dvgw_edi 

Source
Expand description

dvgw-edi — DVGW EDIFACT for the German gas transport and balancing market.

Parses, validates and writes the DVGW-governed formats used in gas balancing (GaBi Gas 2.1, BNetzA BK7-24-01-008). The DVGW counterpart to edi-energy, which covers the BDEW EDI@Energy retail layer.

§The one thing to know first

A DVGW message does not name itself in UNH. Every format is a subset of a UN/EDIFACT D.07A message, so UNH carries the carrierORDERS or ORDRSP — and BGM C002 DE 1001 carries the message:

UNH+1+ORDERS:D:07A:UN:DVGW18'      ← the carrier
BGM+01G::332+NOMINT00052'          ← *this* says NOMINT
DTM+Z05:0:805'                     ← timestamps below are UTC
DTM+137:201801042056:203'          ← message date/time
DTM+Z01:201801050400201801060400:719'  ← Gültigkeitszeitraum = the gas day
RFF+Z13:70030'                     ← Prüfidentifikator

Matching UNH against "NOMINT" therefore rejects every conformant message. Identity here is resolved from DvgwDocument, with the carrier as a cross-check.

§Supported formats

MessageCarrierDocument codes (BGM DE 1001)Prüfidentifikatoren
ALOCAT — AllokationsnachrichtORDRSPX1G X2G X3G X4G X5G X6G X7G XBG70001–70023
NOMINT — NominierungORDERS01G 55G Y1G Y6G Y7G70030–70034
NOMRES — NominierungsantwortORDRSP07G 08G 19G 20G Y2G70035–70039
SSQNOT — Mehr-/MindermengenmeldungORDRSPBAG70095–70096

CONTRL and APERAK acknowledge DVGW interchanges but are BDEW formats; they live in edi-energy and are not reimplemented here.

§Quick start

use dvgw_edi::{DvgwMessageType, DvgwPlatform};

let platform = DvgwPlatform::default();
for result in platform.parse_interchange(raw) {
    let msg = result?;
    println!("{} ({})", msg.message_type, msg.document.description());

    // The gas day is DTM+Z01, decoded through its own format code.
    if let Some(period) = msg.validity_period {
        println!("  Gastag {period}");
    }
    // A LOC group carries a time series, not one value.
    for qty in msg.quantities() {
        println!("  {:?} {:?}", qty.value, qty.period);
    }
    if msg.message_type == DvgwMessageType::Nomint {
        // RFF+AGO — the nomination a re-nomination corrects. A NOMRES has no
        // such reference and is paired on the business key instead.
        println!("  korrigiert {:?}", msg.original_nomination_ref());
    }

    let report = DvgwPlatform::validate_message(&msg);
    for issue in report.errors() {
        eprintln!("  {issue}");
    }
}

§Market roles

RoleAbbreviation
FernleitungsnetzbetreiberFNB
VerteilnetzbetreiberVNB
BilanzkreisverantwortlicherBKV
MarktgebietsverantwortlicherMGV

§Regulatory references

§Relationship to other crates

CrateLayer
dvgw-ediEDIFACT parsing / validation / writing — this crate
mako-gabi-gasGaBi Gas process engine (workflows, deadlines)
edi-energyBDEW EDI@Energy formats (UTILMD, MSCONS, APERAK, …)

Re-exports§

pub use model::EnergyByQualifier;
pub use model::ItemDescription;
pub use model::LineItem;
pub use model::LocationGroup;
pub use model::Party;
pub use model::Quantity;
pub use model::Reference;

Modules§

model
The typed message model: positions, locations, quantities and parties. The typed message model, shared by all four DVGW families.
ssqnot
SSQNOT read as one Mehr-/Mindermengen record. SSQNOT — the Mehr-/Mindermengenmeldung zur Führung des Netzkontos, read as one business record.

Structs§

CorrelationKey
A resolved Zuordnungstupel — the tuple and the values read for it.
DvgwIssue
A single validation finding.
DvgwMessage
A parsed DVGW message.
DvgwPeriod
A half-open period [start, end) from a format-719 value.
DvgwPlatform
Parse configuration and entry points for DVGW EDIFACT.
DvgwReport
The result of validating one DVGW message.
DvgwVersion
The Anwendungscode from UNH S009 DE 0057.
MessageBuilder
Builds a complete DVGW message.
PidInfo
One published DVGW Anwendungsfall.
Position
One LIN position under construction.
Pruefidentifikator
A validated DVGW Prüfidentifikator.

Enums§

Carrier
The UN/EDIFACT message that carries a DVGW format on the wire (UNH DE 0065).
DtmFormat
The DTM C507 DE 2379 format codes DVGW uses.
DtmValue
A decoded DTM value.
DvgwDocument
The DVGW document-name code from BGM C002 DE 1001 — the field that says which business message this actually is.
DvgwMessageType
The logical DVGW message family.
Error
Errors produced by dvgw-edi.
Severity
How badly a finding breaks the message.
Zuordnung
The Zuordnungstupel a Prüfidentifikator is assigned.

Constants§

DVGW_AGENCY_CODE
The code-list responsible agency DVGW stamps on every coded value (DE 3055 = 332).
PID_MAX
Highest code DVGW allocates.
PID_MIN
Lowest code DVGW allocates.
SSQNOT_RLM_CUTOFF
The Anwendungsfall SSQNOT 5.7 §4 Hinweis [500] retires: 70096 (Mehr-/Mindermengenmeldung RLM) is admitted only for Zeiträume before this day, as is the STS+A2G RLM marker (Hinweis [501]).

Functions§

assigned_pids
Every Prüfidentifikator the shipped catalogue assigns a Zuordnung.
catalogue
Every catalogued Anwendungsfall, ascending by Prüfidentifikator.
catalogue_for
The catalogued Anwendungsfälle for one message family.
sniff
Does this interchange carry a DVGW message?