Expand description
powerio: lossless parsing and a typed data model for power system case
files.
Readers and writers cover MATPOWER .m, PowerModels JSON, PSS/E .raw,
PowerWorld .aux, pandapower JSON, PyPSA CSV, and egret JSON. PowerWorld
.pwb case files are read only; .pwd display files parse through
parse_display_file. Case formats meet at the typed Network, and
Network::to_format reports whatever a target format cannot represent.
See the crate::format module for the two-tier fidelity contract.
Writing back to the source format reproduces the file byte for byte:
parse → write → parse returns the original text, down to comments and
exact numeric tokens. The crate keeps a small dependency set so other
tools can embed it as a parser without a matrix or solver stack; the
matrices live in the powerio-matrix crate.
use powerio::{parse_str, TargetFormat};
let src = "\
function mpc = example
mpc.version = '2';
mpc.baseMVA = 100;
mpc.bus = [
\t1\t3\t0\t0\t0\t0\t1\t1\t0\t230\t1\t1.1\t0.9;
\t2\t1\t0\t0\t0\t0\t1\t1\t0\t230\t1\t1.1\t0.9;
];
mpc.branch = [
\t1\t2\t0.01\t0.1\t0\t0\t0\t0\t0\t0\t1\t-360\t360;
];
";
let net = parse_str(src, "matpower")?.network;
assert_eq!(net.buses.len(), 2);
assert_eq!(net.to_format(TargetFormat::Matpower).text, src);Re-exports§
pub use error::ElementCounts;pub use error::Error;pub use error::ErrorCategory;pub use error::Result;pub use error::ScenarioMismatch;pub use format::Conversion;pub use format::DisplayData;pub use format::DisplayFormat;pub use format::Parsed;pub use format::PwdDisplay;pub use format::PwdSubstation;pub use format::PypsaCsvOutputs;pub use format::TargetFormat;pub use format::convert_file;pub use format::convert_str;pub use format::display_format_from_name;pub use format::parse_display_bytes;pub use format::parse_display_file;pub use format::parse_egret_json;pub use format::parse_file;pub use format::parse_matpower;pub use format::parse_matpower_file;pub use format::parse_pandapower_json;pub use format::parse_powermodels_json;pub use format::parse_powerworld;pub use format::parse_psse;pub use format::parse_str;pub use format::read_pypsa_csv_folder;pub use format::target_format_from_name;pub use format::write_as;pub use format::write_egret_json;pub use format::write_matpower;pub use format::write_pandapower_json;pub use format::write_powermodels_json;pub use format::write_powerworld;pub use format::write_psse;pub use format::write_pypsa_csv_folder;pub use indexed::ConnectivityReport;pub use indexed::IndexCore;pub use indexed::IndexedNetwork;pub use network::Branch;pub use network::Bus;pub use network::BusId;pub use network::BusType;pub use network::Extras;pub use network::GenCaps;pub use network::GenCost;pub use network::Generator;pub use network::Hvdc;pub use network::Load;pub use network::Network;pub use network::Shunt;pub use network::SourceFormat;pub use network::Storage;