pub fn parse(source: Source) -> Result<PioModule<BalancedNetwork>, Error>Expand description
Parse the case file at path, choosing the parser from from (the
parse_target_format names plus pypsa-csv/pypsa, pwb, pslf,
and epc) or, when None, from the path: a directory containing
network.csv parses as a PyPSA CSV folder (any other directory is refused
as a directory with Error::UnknownFormat, before extension inference),
and a file maps by extension (m/json/raw/aux/pwb/epc),
case insensitively (issue #97: .RAW is as common as .raw in the wild);
a .txt or .cdf file whose first card is an IEEE CDF title card reads
as ieee-cdf. A
.json file is classified by top level shape markers: pandapower
("_class": "pandapowerNet"), egret (elements and system), GO Challenge
3 (network plus time_series_input/reliability, refused here with
guidance to the typed facade parser), Surge JSON
(format: "surge-json"), OPFData (grid, solution, and metadata), and
PowerModels JSON (baseMVA, branch, gen, or gencost). JSON matching
distribution markers, ambiguous markers, or no known markers returns
Error::UnknownFormat.
Declare a format on the source to force a parser. PowerWorld .pwb is a
binary input only format; PSLF .epc is text and supports emission. Returns
the typed module: the network value, the parser’s findings, and the retained
source.
The balanced network parser used by the top level facade. The CLI and language bindings call that facade so calculation formats such as GO Challenge 3 keep their typed values.
§Errors
A Request failure when the format cannot be determined or is refused, an
Io failure when acquisition fails, and the parser’s own failure on
malformed input. Findings collected before a failure ride the returned
error.