Skip to main content

target_format_from_name

Function target_format_from_name 

Source
pub fn target_format_from_name(name: &str) -> Option<TargetFormat>
Expand description

Map a format name (with the common aliases) to a TargetFormat, or None if unrecognized. Accepts matpower/m, powermodels-json/powermodels/pm, egret-json/egret, pandapower-json/pandapower/pp, psse/raw, powerworld/aux, pslf/epc, goc3-json/goc3, and surge-json/surge, and opfdata-json/opfdata/gridopt. The powerio-json/powerio/json names remain compatibility aliases for the model JSON methods. Case-insensitive. The one place the bindings (Python, C ABI) share, so a new text format means one new arm here, not three. PyPSA CSV folders, GridFM datasets, and PowerWorld .pwb are directory or read only inputs with no text target; they are routed by crate::format::routing.

The powermodelsjson/egretjson/pandapowerjson aliases let a SourceFormat’s string form ({:?} lowercased, e.g. "PowerModelsJson") round-trip back to a target, so net.to_format(other.source_format) works for every format.