Skip to main content

Crate powerio

Crate powerio 

Source
Expand description

Typed balanced network models, parsers, and writers.

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, Surge JSON, and DeepMind OPFData JSON. PowerWorld .pwb case files are read only, and GO Challenge 3 and OPFData JSON have no canonical writer beyond same source echo; .pwd display files parse through parse_display_file. Each reader produces a Network. Network::to_format returns the serialized target and warnings for fields the target cannot represent. See crate::format for format routing and fidelity rules.

A reader that retains source text can return those bytes when writing the same format. Matrix and problem instance builders live in separate crates.

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 dc::DcConvention;
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::SourceDocument;
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_deepmind_opfdata_json;
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 geo::Canvas;
pub use geo::CoordinateSpace;
pub use geo::CoordsKind;
pub use geo::ElementKey;
pub use geo::GeoApplyReport;
pub use geo::GeoFeature;
pub use geo::GeoGeometry;
pub use geo::GeoLayer;
pub use geo::GeoMeta;
pub use geo::GeoParsed;
pub use geo::GeoTarget;
pub use geo::Location;
pub use geo::apply_substation_points;
pub use geo::geo_layer_from_pwd;
pub use geo::pwd_mercator_to_lonlat;
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§

dc
Conventions shared by DC network models and matrix builders.
error
format
Readers and writers for supported case formats, all meeting at Network.
gen_cost
geo
Typed coordinate metadata for the balanced model, and the standalone geographic document (GeoLayer) that carries coordinates as a file of their own.
indexed
IndexedNetwork: the dense-indexed analysis view over a Network.
network
Format neutral balanced network model.
solver_tables
Normalized dense tables for solver and compiler front ends.

Structs§

NormalizeOptions
Options for Network::to_normalized_with_options.
NormalizedNetwork
Output of Network::to_normalized_with_options.
Selector
Which buses a subset keeps: inclusive ranges over area, zone, base kV, and bus number, ANDed together. An unset (None) filter matches every bus, so Selector::default selects the whole network.

Constants§

POWER_MODELS_ANGLE_BOUND_PAD
Default branch angle difference bound used by PowerModels parse time repair.
VERSION
The powerio crate version, for provenance fields written by downstream crates whose own version can drift from the core’s.