DTF legacy input format

Sparlectra reads the fixed-column DTF files of the legacy Testnetz13 validation examples natively: DTFImporter.read_dtf parses a file, DTFImporter.build_net or createNetFromDTFFile builds the Net. Outage cards, trailing records, transformer control fields, nameplate voltages and branch identity metadata stay on typed records, raw lines included. FOR002 text reports are validation references, not model input. Sparlectra's own deck ships as data/dtf_demo/sp_dtf5.DAT (Demo cases).

Format detection

A DTF deck is recognised by its content: a file that read_dtf takes as a network (every card the size card counts is there, and one bus card is the slack bus) is a deck, whatever its name. No format has to be named:

run_sparlectra(casefile = "data/dtf_demo/sp_dtf5.DAT")

A .DAT file the reader does not take (a FOR002 result report, an outage list without a network, any other text) is refused with its name and the reason. DTFImporter.is_dtf_deck(path) answers the question alone.

File structure

CardFieldsNotes
Parameter/text cardslegacy run parameters, free-text descriptorsKept for diagnostics only.
Nominal-voltage cardvoltage bases referenced by voltage-level indicesBranch R/X/G/B per-unit conversion uses the branch voltage-level index; a 231 kV level is not collapsed to 230 kV.
Size/count cardbus, branch, compensation and transformer-control counts, named slack busThe counts split the fixed-column sections before optional outage or trailing data is parsed.
Branch cards (L, T)lines and transformersT marks a transformer, every other kind is an AC line. Transformer transverse conductance and susceptance become the PI branch fields g_pu and b_pu (branch shunt arms, not node shunts).
Compensation cardsfixed compensation records of the base network
Transformer-control cardswinding/nameplate voltages, longitudinal tap range and step, optional Schraegregler skew-angle fieldsMatched to the transformer by terminals and parallel identifier. The metadata holds the parsed winding values, ratio convention, neutral base ratio, relative tap fraction, skew angle, effective ratio and effective phase shift.
Bus cardsbus type, voltage-level index, name, start voltage, angle, load, generation
Outage recordsbetween AUSFALL and ENDE, after the bus sectionOptional, see below.
Trailing branch-echo recordsa standalone A marker followed by a branch-like L or T recordDuplicates existing branch information for legacy diagnostics; kept as metadata, neither an additional branch nor an outage.

Outage records

Every non-empty record between AUSFALL and ENDE identifies one branch outage by branch kind, voltage-level index, parallel identifier, from-bus name and to-bus name. Applying one requires a match to exactly one base-network branch; a missing or ambiguous match produces a diagnostic and removes nothing. Branch cards carry no per-end switch field, so the aggregate branch status is used; a partially open branch cannot be expressed.

PV, PQ and slack bus interpretation

The slack bus comes from the size card and becomes a Sparlectra slack generator; PV-style buses keep their voltage-regulating role; PQ generator/load buses keep fixed injections and are not promoted to PV because non-zero generation appears on the card.

Transformer ratio convention

Winding values such as 400/231 kV are nameplate metadata, not a permanent off-nominal tap; tap positions and skew angles apply as deviations from neutral. A control card with tap range and maximum step but without the actual step sits at its middle position, step 0, and the import names it in an info line. transformer_ratio_mode selects the neutral base ratio:

  • :neutral_one (default, the observed FOR002 legacy semantics): the base ratio at neutral tap is 1.0.
  • :winding_over_network: the winding/nameplate ratio divided by the network nominal-voltage ratio, for example (400/231) / (400/230).

The nameplate ratio stays visible in the metadata fields nominal_unregulated_kv, nominal_regulated_kv, from_bus_vn_kV, to_bus_vn_kV, winding_over_network_base_ratio, transformer_ratio_mode, base_ratio_used, tap_fraction, skew_angle_deg, effective_ratio and effective_shift_deg.

With model.tap_changer_model = impedance_correction the tap_fraction/skew_angle_deg values are also folded into the transformer series impedance, and a later writeMatpowerCasefile export writes the corrected values with a reimport marker (Transformer tap-changer model).

The 60-degree field of the Schraegregler example is the skew angle of the regulating voltage, not the final phase shift: the complex tap follows from tap range, tap position and skew angle, converted to the from-side off-nominal convention (reciprocal magnitude, negative regulating-vector angle).

Transformer shunt conductance and losses

DTF transformer G is stored as Branch.g_pu, part of the PI branch model, not as a terminal bus shunt (Branch model). calcNetLosses! sums branch-end powers (S_from + S_to), so total losses include the longitudinal R and the voltage-dependent G losses; the separate I²R helper reports the longitudinal component only. The MATPOWER export keeps g_pu across a round trip in mpc.sparlectra.transformer_losses (MATPOWER cases); standard MATPOWER readers ignore it.

Validation against FOR002

The validation examples compare native solves against FOR002 reports for cases A-E in both :neutral_one and :winding_over_network mode.

Web UI .DAT roles

The Web UI classifies .DAT uploads by content (FOR002.DAT-style names are hints only); a network case is what the format detection above takes as a deck:

RoleMeaning
dtf_network_caseComplete DTF network case with mandatory cards and counts; selectable as the primary case.
dtf_network_case_with_outagesAlso runnable; exposes the embedded outage records to the outage controls.
dtf_outage_or_referenceKept for the DTF outage/reference controls, not runnable as a primary case.
unknown_datKept only when it passes the upload safety checks, never offered as a runnable case.