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¶
The current version of the network JSON file format. |
Functions¶
|
Create the electrical network elements from a dictionary. |
|
Return a dictionary of the current network data. |
|
Convert a v0 network dict to a v1 network dict. |
|
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.