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, egret JSON, PSLF .epc, GO
Challenge 3 JSON, and Surge JSON. PowerWorld .pwb case files are read
only, and GO Challenge 3 JSON has no canonical writer beyond same source
echo; .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 behavior.
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::WriteOptions;pub use format::convert_file;pub use format::convert_file_with_options;pub use format::convert_str;pub use format::convert_str_with_options;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_goc3_json;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_pslf;pub use format::parse_psse;pub use format::parse_str;pub use format::parse_surge_json;pub use format::read_pypsa_csv_folder;pub use format::target_format_from_name;pub use format::write_as;pub use format::write_as_with_options;pub use format::write_dir;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_pslf;pub use format::write_psse;pub use format::write_psse_rev;pub use format::write_pypsa_csv_folder;pub use format::write_surge_json;pub use gen_cost::GenCostPatch;pub use gen_cost::GenCostPolicyReport;pub use gen_cost::MissingGenCostPolicy;pub use gen_cost::parse_gen_cost_csv;pub use indexed::ConnectivityReport;pub use indexed::IndexCore;pub use indexed::IndexedNetwork;pub use network::Area;pub use network::BalancedNetwork;pub use network::Branch;pub use network::BranchCharging;pub use network::BranchCurrentRatings;pub use network::BranchRatingSet;pub use network::BranchSolution;pub use network::Bus;pub use network::BusId;pub use network::BusType;pub use network::DEFAULT_BASE_FREQUENCY;pub use network::Diagnostic;pub use network::Extras;pub use network::GenCaps;pub use network::GenCost;pub use network::Generator;pub use network::Hvdc;pub use network::Impedance;pub use network::Load;pub use network::LoadVoltageModel;pub use network::Network;pub use network::Shunt;pub use network::ShuntBlock;pub use network::SolverParams;pub use network::SourceFormat;pub use network::Storage;pub use network::Switch;pub use network::SwitchedShuntControl;pub use network::SwitchedShuntMode;pub use network::Transformer3W;pub use network::TransformerControl;pub use network::TransformerControlMode;pub use network::Winding;pub use solver_tables::NORMALIZED_SOLVER_TABLES_PASS;pub use solver_tables::NormalizedSolverTables;pub use solver_tables::SolverArcRow;pub use solver_tables::SolverArcTerminal;pub use solver_tables::SolverBranchRow;pub use solver_tables::SolverBusRow;pub use solver_tables::SolverCostRow;pub use solver_tables::SolverGeneratorRow;pub use solver_tables::SolverHvdcRow;pub use solver_tables::SolverLoadRow;pub use solver_tables::SolverShuntRow;pub use solver_tables::SolverStorageRow;pub use solver_tables::SolverSwitchRow;pub use solver_tables::SolverTableIndex;pub use solver_tables::SolverTableUnits;
Modules§
- error
- format
- Readers and writers for supported case formats, all meeting at
Network. - gen_
cost - indexed
IndexedNetwork: the dense-indexed analysis view over aNetwork.- network
- Format-neutral network model: the hub every converter meets at.
- solver_
tables - Normalized dense tables for solver and compiler front ends.
Structs§
- Selector
- Which buses a
subsetkeeps: inclusive ranges over area, zone, base kV, and bus number, ANDed together. An unset (None) filter matches every bus, soSelector::defaultselects the whole network.