Parsers#

parse_rawx(path)#

Parse a RAWX (JSON) file into a GpfCase.

Parsing does not validate the data; call case.validate_schema() on the result if you need schema validation.

parse_raw(path, *, allow_unmodeled_sections=False)#

Parse a RAW (text) file into a GpfCase.

Parameters:
  • path -- Filesystem path to the RAW file.

  • allow_unmodeled_sections --

    If False (default), raise ValueError on the first data row inside a section the parser knows about but does not yet model (GNE, induction machine, substation). If True, those records are dropped one physical line at a time — use this only when you've confirmed the dropped section can't affect the PF result for your case.

    CAVEAT: SUBSTATION DATA is multi-line per record (the substation header is followed by per-node and per-switch sub-records). The drop-one-line path will line up correctly when the next section marker appears, but anything that depends on knowing record boundaries within the section (e.g. node count) is unavailable today; only use the bypass when the section is empty or otherwise irrelevant to the power-flow result.

Returns:

The parsed GpfCase. Parsing does not validate the data; call GpfCase.validate_schema() if you need schema validation.

Raises:

ValueError -- If the file is malformed, has no header record, or contains a data row in an unmodeled section while allow_unmodeled_sections is False.

parse_matpower(path)#

Parse MATPOWER .m file to GpfCase.

Parameters:

path -- Path to .m case file (e.g., case9.m, case14.m)

Returns:

GpfCase with buses, loads, generators, branches, transformers

Raises: