roseau.load_flow.io.dict

This module is not for public use.

Use the ElectricalNetwork.from_dict and ElectricalNetwork.to_dict methods to serialize networks from and to dictionaries, or the methods ElectricalNetwork.from_json and ElectricalNetwork.to_json to read and write networks from and to JSON files.

Attributes

NETWORK_JSON_VERSION

The current version of the network JSON file format.

Functions

network_from_dict(...)

Create the electrical network elements from a dictionary.

network_to_dict(→ roseau.load_flow.typing.JsonDict)

Return a dictionary of the current network data.

v0_to_v1_converter(→ roseau.load_flow.typing.JsonDict)

Convert a v0 network dict to a v1 network dict.

v1_to_v2_converter(→ roseau.load_flow.typing.JsonDict)

Convert a v1 network dict to a v2 network dict.

Module Contents

NETWORK_JSON_VERSION = 2

The current version of the network JSON file format.

network_from_dict(data: JsonDict, *, include_results: bool = True) tuple[dict[Id, Bus], dict[Id, Line], dict[Id, Transformer], dict[Id, Switch], dict[Id, AbstractLoad], dict[Id, VoltageSource], dict[Id, Ground], dict[Id, PotentialRef], bool]

Create the electrical network elements from a dictionary.

Parameters:
  • data – The dictionary containing the network data.

  • include_results – If True (default) and the results of the load flow are included in the dictionary, the results are also loaded into the network.

Returns:

The buses, lines, transformers, switches, loads, sources, grounds and potential refs to construct the electrical network and a boolean indicating if the network has results.

network_to_dict(en: ElectricalNetwork, *, include_results: bool) JsonDict

Return a dictionary of the current network data.

Parameters:
  • en – The electrical network.

  • include_results – If True (default), the results of the load flow are included in the dictionary. If no results are available, this option is ignored.

Returns:

The created dictionary.

v0_to_v1_converter(data: JsonDict) JsonDict

Convert a v0 network dict to a v1 network dict.

Parameters:

data – The v0 network data.

Returns:

The v1 network data.

v1_to_v2_converter(data: JsonDict) JsonDict

Convert a v1 network dict to a v2 network dict.

Parameters:

data – The v1 network data.

Returns:

The v2 network data.