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, powerio-json/powerio/json (the canonical snapshot; plain json means this one, the foreign JSON dialects are namespaced), pslf/epc, goc3-json/goc3, and surge-json/surge. 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.