Skip to main content

Crate powerio_tx

Crate powerio_tx 

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 BalancedNetwork. BalancedNetwork::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_core::Source;
use powerio_tx::{TargetFormat, format_id_for, parse, write_as};

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 source = Source::from_bytes("example.m", src.as_bytes().to_vec())?
    .with_format(format_id_for("matpower")?);
let module = parse(source)?;
assert_eq!(module.value().buses().len(), 2);
// An unchanged parsed module echoes its source bytes exactly.
assert_eq!(write_as(&module, TargetFormat::Matpower)?.text, src);

Re-exports§

pub use dc::DcConvention;
pub use dc::DcNetworkData;
pub use dc::dc_network_data;
pub use diagnostics::EmitFamily;
pub use error::Error;
pub use error::Result;
pub use format::routing::Detection;
pub use format::routing::JSON_CLASSES;
pub use format::routing::JsonClass;
pub use format::routing::classify_json_bytes;
pub use format::routing::classify_json_text;
pub use format::Conversion;
pub use format::DisplayData;
pub use format::DisplayFormat;
pub use format::OpfDataSolution;
pub use format::PwdDisplay;
pub use format::PwdSubstation;
pub use format::PypsaCsvOutputs;
pub use format::PypsaCsvSequence;
pub use format::SOURCE_FORMAT_NAMES;
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::format_id_for;
pub use format::parse;
pub use format::parse_display_bytes;
pub use format::parse_display_file;
pub use format::parse_egret_time_series;
pub use format::parse_goc3_json;
pub use format::parse_opfdata_json;
pub use format::parse_pypsa_csv_time_series;
pub use format::target_format_from_name;
pub use format::write;
pub use format::write_as;
pub use format::write_as_with_options;
pub use format::write_dir;
pub use format::write_dir_with_options;
pub use format::write_egret_json;
pub use format::write_matpower;
pub use format::write_network;
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;
pub use format::write_pypsa_csv_folder;
pub use format::write_surge_json;
pub use format::write_with_options;
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_aux_substations;
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::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::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 network::repair_values;
pub use network::series_admittance_of;
pub use solver_tables::NORMALIZED_SOLVER_TABLES_PASS;
pub use solver_tables::SolverArcTerminal;
pub use solver_tables::SolverTableIndex;
pub use solver_tables::SolverTableUnits;

Modules§

dc
Conventions shared by DC network models and matrix builders.
diagnostics
The codes this crate emits, and the registry gates over them.
error
format
Readers and writers for supported case formats, all meeting at BalancedNetwork.
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 BalancedNetwork.
network
Format neutral balanced network model.
solver_tables
Normalized dense tables for solver and compiler front ends.
version
The version every powerio authored document carries, and the rule a reader applies to it.

Structs§

Diagnostic
One coded user facing finding.
DiagnosticCode
Stable dotted identity of one diagnostic.
NormalizeOptions
Options for BalancedNetwork::to_normalized_with_options.
NormalizeSourceRows
Row provenance for one normalize pass: for each dense position in the IndexedNetwork view of the normalized network, the row of the same element family in the source network. None marks an element the pipeline synthesized, which has no source row.
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.

Enums§

DiagnosticSeverity
Severity of one user facing finding.
ErrorCategory
Coarse classification of an Error, for callers that map onto their own taxonomy. Defined in powerio-core so every crate in the workspace projects onto the same five tokens. Coarse projection of an operation failure for bindings and exit statuses.

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.