roseau.load_flow.io

This module provides functions to read and write networks from and to different formats.

You do not need to use this module directly, you can read and write networks using the corresponding methods of the ElectricalNetwork object.

Subpackages

Submodules

Functions

network_from_dgs(...)

Create the electrical elements from a JSON file in DGS format.

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.

Package Contents

network_from_dgs(filename: StrPath) 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]]

Create the electrical elements from a JSON file in DGS format.

Parameters:

filename – name of the JSON file

Returns:

The elements of the network – buses, lines, transformers, switches, loads, sources, grounds and potential refs.

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.