Expand description
Readers and writers for supported case formats, all meeting at Network.
Each format module owns its reader and/or writer: MATPOWER .m,
PowerModels JSON, PSS/E .raw, PowerWorld .aux, egret ModelData JSON,
pandapower JSON, PyPSA CSV folders, PSLF .epc, GO Challenge 3 JSON, and
Surge JSON. PowerWorld .pwb cases, GO Challenge 3 JSON canonical output,
and PowerWorld .pwd displays are read only. Case input and
output formats meet here, so adding a writable format is one module plus
one hub registration.
parse_file reads Network cases, detecting the format from its extension;
parse_display_file reads display artifacts such as PowerWorld .pwd.
write_as serializes a Network to text targets. Directory formats,
such as PyPSA CSV folders, use explicit filesystem helpers. Non-finite
numeric values, such as MATPOWER Inf/NaN angle limits, are written as
JSON null.
§Fidelity behavior
Conversion is two-tier:
- Same format writes return the original text. A reader keeps its source
text (see
Network), so writing back to the same format returns every field, comment, and numeric token. - Cross-format keeps maximal fidelity with itemized loss. Whatever the
target format cannot represent is reported in the
Conversionwarnings, never dropped silently. On the read side, readers itemize what they ignore inParsedwarnings.
Modules§
- goc3_
bridge - Document-walking helpers shared with
powerio-pkg’s operating point extractor, which must interpret a GOC3 document exactly as this parser does: same section ordering, same device row assignment, same cost mapping. Hidden: not part of the public format API. - powerworld
- Read and write PowerWorld auxiliary
.auxfiles. - routing
- Shared format alias and JSON shape routing for the
poweriocrate.
Structs§
- Conversion
- Output of a conversion: the serialized text plus any fidelity warnings:
data the target can’t represent, defaults synthesized, or blocks mapped best
effort. An empty
warningsmeans a faithful conversion. Forconvert_fileandconvert_str,warningscarries the read side (Parsedwarnings) too, ahead of the write side. - Parsed
- Output of a parse: the network plus the reader’s fidelity warnings, tables and columns the model cannot carry, reported instead of dropped silently. Empty for readers that don’t report read warnings (currently readers that do not need to reduce any source fields).
- PwdDisplay
- Decoded PowerWorld display file content.
- PwdSubstation
- One substation symbol from a display file: the identity row joined with
its drawing record, in identity table (display) order.
xandyare diagram coordinates as stored, y north positive (see the module docs). - Pypsa
CsvOutputs - Write
Options - Optional write-time policies layered on top of the neutral
Network.
Enums§
- Display
Data - Output of a display parse. v0.2.2 supports PowerWorld
.pwd; future display formats can add variants without changing the parse entry point. - Display
Format - A display artifact format. These files are not power network cases and do
not parse to
Network. - Target
Format - A target interchange format. See
write_as.
Functions§
- convert_
file - Convert a case file to
to, optionally forcing the source format withfrom. - convert_
file_ with_ options - Convert a case file with write-time cost policies.
- convert_
str - Convert in-memory case
textof the namedformat(seetarget_format_from_name) toto. - convert_
str_ with_ options - Convert in-memory case text with write-time cost policies.
- display_
format_ from_ name - Map a display format name to a
DisplayFormat, orNoneif unrecognized. Acceptspwd,powerworld-pwd, andpowerworld-display. - parse_
display_ bytes - Parse display bytes in the named display
format. - parse_
display_ file - Parse the display file at
path, choosing the reader fromfromor, whenNone, from the extension. v0.2.2 infers PowerWorld.pwd. - parse_
egret_ json - Parse egret
ModelDataJSON into aNetwork. - parse_
file - Parse the case file at
path, choosing the reader fromfrom(thetarget_format_from_namenames pluspypsa-csv/pypsa,pwb,pslf, andepc) or, whenNone, from the path: a directory containingnetwork.csvparses as a PyPSA CSV folder (any other directory fails:Error::UnknownFormatwhen its name maps to no extension, the I/O error otherwise), and a file maps by extension (m/json/raw/aux/pwb/epc), case insensitively (issue #97:.RAWis as common as.rawin the wild). A.jsonfile is classified by top level shape markers: pandapower ("_class": "pandapowerNet"), egret (elementsandsystem), GO Challenge 3 (networkplustime_series_input/reliability), Surge JSON (format: "surge-json"), powerio-json (busesplus network keys), and PowerModels JSON (baseMVA,branch,gen, orgencost). JSON matching distribution markers, ambiguous markers, or no known markers returnsError::UnknownFormat. Passfromto force a transmission format. PowerWorld.pwbis a binary read only format with no retained source; PSLF.epcis text and has a writer. ReturnsParsed: the network plus the reader’s fidelity warnings. - parse_
goc3_ json - Parse a GO Challenge 3 JSON input file.
- parse_
matpower - Parse the MATPOWER case in
contentinto aNetwork. - parse_
matpower_ file - Parse the MATPOWER case at
path, using the file stem as the network name. - parse_
pandapower_ json - Parse pandapower
pandapowerNetJSONcontent. ReturnsParsed: the network plus the reader’s fidelity warnings. - parse_
powermodels_ json - Parse PowerModels.jl network data JSON into a
Network. Loads and shunts are read as first-class elements and the raw text is retained, so writing back to PowerModels JSON is a byte-exact echo.per_unit = trueinput (powerio’s own output, and PowerModels’ own export) is converted to the neutral MW/degree convention (powers ×baseMVA, angles to degrees, cost coefficients un-scaled), following PowerModels’ own exceptions (storageps/qsstay raw, dclinept/qf/qtflip sign);per_unit = falseis read as-is. - parse_
powerworld - Parse a PowerWorld
.auxinto aNetwork, reading the Bus/Load/Shunt/ Gen/BranchDATAblocks by their declared field lists. - parse_
pslf - Parse a PSLF
.epccase into aNetwork. - parse_
psse - Parse a PSS/E
.raw(revisions 33-35) into aNetwork. Reads bus/load/ fixed-shunt/generator/branch/2- and 3-winding transformer; skips the advanced sections. - parse_
str - Parse in-memory case
textof the namedformat(seetarget_format_from_name). ReturnsParsed: the network plus the reader’s fidelity warnings. - parse_
surge_ json - read_
pypsa_ csv_ folder - Read a PyPSA CSV folder at
path. ReturnsParsed: the network plus the reader’s fidelity warnings. - target_
format_ from_ name - Map a format name (with the common aliases) to a
TargetFormat, orNoneif unrecognized. Acceptsmatpower/m,powermodels-json/powermodels/pm,egret-json/egret,pandapower-json/pandapower/pp,psse/raw,powerworld/aux,powerio-json/powerio/json(the canonical snapshot; plainjsonmeans this one, the foreign JSON dialects are namespaced),pslf/epc,goc3-json/goc3, andsurge-json/surge. Case-insensitive. The one place the bindings (Python, C ABI) share, so a new text format means one new arm here, not three. PyPSA CSV folders, GridFM datasets, and PowerWorld.pwbare directory or read only inputs with no text target; they are routed bycrate::format::routing. - write_
as - Convert a
Networktoformat. Writing back to the source format returns the retained source text; otherwise the network is serialized into the target. - write_
as_ with_ options - Convert a
Networkwith write-time cost policies. The oldwrite_asbehavior is preserved whenoptionsis default. - write_
dir - Write
netinto the directoryout_diras the named directory-shaped format: the directory sibling ofwrite_as, sharing its name-dispatch role for the bindings. PyPSA CSV (pypsa-csv/pypsa) is the one such format today; a text format name is rejected by name, pointing atwrite_as. Returns the write’s fidelity warnings. - write_
egret_ json - write_
matpower - Serialize
netto MATPOWER.mtext. Echoes the retained source verbatim whennetcame from MATPOWER; otherwise emits canonical.m. - write_
pandapower_ json - write_
powermodels_ json - write_
powerworld - write_
pslf - Serialize
netto PSLF.epctext. - write_
psse - Serialize
netto PSS/E.rawat the default revision (33). - write_
psse_ rev - Serialize
netto PSS/E.rawatrev(33, 34, or 35). - write_
pypsa_ csv_ folder - write_
surge_ json