Skip to main content

Module powerworld

Module powerworld 

Source
Expand description

Read and write PowerWorld auxiliary .aux files.

The reader is layered. parse_aux parses any auxiliary file into the generic AuxFile — every DATA and SCRIPT section, with field lists, value rows, and SUBDATA blocks intact — and knows the grammar from the official format guide: legacy and concise headers, comma delimited (CSV) sections, multiline field lists and value rows, // comments, quoting, and variablename:location field suffixes. On top of it, the Network mapping consumes the power flow core types (Bus, Load, Shunt, Gen, Branch) by field name, so column order and extra columns don’t matter. Object types outside the core stay reachable through aux_sections and survive the same format round trip byte for byte via the retained source (see crate::write_as).

The writer emits DATA (Object, [fields]) { … } blocks for the core types, values in MW/MVAr/degrees, status as Closed/Open. Generator cost, HVDC, and storage are not represented and are reported on write.

.pwb binary cases are read (never written) by parse_pwb; see that module for the decoded vintages and the parity evidence. .pwd display files carry no case data, only the diagram; parse_pwd_file and parse_pwd read the decoded substation coordinates.

Structs§

AuxFile
A parsed auxiliary file: the ordered DATA and SCRIPT sections.
AuxObject
One DATA section: an object type, its declared field list, and the rows.
AuxRow
One value row of a DATA section, with any SUBDATA blocks that follow it.
AuxScript
A SCRIPT section, retained verbatim: powerio executes nothing.
AuxSubData
A <SUBDATA Type> ... </SUBDATA> block. The interior format is fixed per subobject type (some are free text, some are per line records), so the lines are kept verbatim.
Contingency
One contingency from a Contingency DATA section, with the actions of its CTGElement SUBDATA.
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. x and y are diagram coordinates as stored, y north positive (see the module docs).

Enums§

AuxSection
One section of an auxiliary file.

Functions§

aux_sections
Parse the auxiliary sections of a PowerWorld-sourced Network’s retained source. The typed model carries the power flow core; everything else in the original file (contingencies, limit sets, substations, …) is reachable here.
contingencies
The contingencies of a parsed aux file, in file order.
parse_aux
Parse auxiliary file text into an AuxFile.
parse_powerworld
Parse a PowerWorld .aux into a Network, reading the Bus/Load/Shunt/ Gen/Branch DATA blocks by their declared field lists.
parse_pwb
Parse .pwb bytes into a Network. name_hint (the file stem) names the network; the binary carries no case name in the decoded region.
parse_pwd
Parse the substation coordinates out of .pwd bytes.
parse_pwd_display
Parse a .pwd display file, returning metadata and decoded substations.
parse_pwd_file
Read and parse a .pwd display file.
rating_set_names
Name → row lookup for the per object-type rating set names (RatingSetNameBus, RatingSetNameBranch, RatingSetNameInterface). Returns (set_number, name) pairs in file order.
write_aux
Serialize an AuxFile in canonical form: legacy headers, space delimited values, one row per line, two space indentation. Idempotent under parse_aux.
write_powerworld