cronian.configuration
Functions
|
Load configurations and perform basic validation check for duplicate IDs. |
|
Load the general configuration file. |
|
Helper function to load YAML configuration files from a subfolder. |
|
Check for duplicate ids within generator and prosumer agents. |
Module Contents
- cronian.configuration.load_configurations(configurations_folder: pathlib.Path) dict
Load configurations and perform basic validation check for duplicate IDs.
- Parameters:
configurations_folder – Path to folder containing configuration files.
- Returns:
- Nested dictionary containing the configurations defining
generators, prosumers, and general parameters of the simulation.
- Return type:
configurations
- Raises:
ValueError – If duplicate IDs exist among generator or prosumer agents.
Example usage:
>>> from pyprojroot import here ... >>> configurations_folder = here("tests/test_data/demo_configurations") >>> configurations = load_configurations(configurations_folder) >>> print(configurations["Generators"]) >>> print() >>> print(configurations["Prosumers"])
- cronian.configuration.load_general_config(general_config_path: pathlib.Path) dict
Load the general configuration file.
- Parameters:
general_config_path – Path to the general configuration.
- Returns:
The loaded general configuration.
- Return type:
general_config
- Raises:
ValueError – If ‘General’ key is missing in general configuration file.
- cronian.configuration.load_configurations_subfolder(folder: pathlib.Path, top_level_key: str) dict[str, dict]
Helper function to load YAML configuration files from a subfolder.
- Parameters:
folder – Path to the folder containing configuration files.
top_level_key – Top keys in configurations: Generators or Prosumers.
- Returns:
Dict with agent id as key and config as value.
- Return type:
agent_configurations
- Raises:
ValueError – If the top-level key is missing in any of the config files or if any configurations share an ID.
- cronian.configuration.check_duplicate_ids(ids: list[str]) None
Check for duplicate ids within generator and prosumer agents.
- Parameters:
ids – List of ids listed in the configuration files.
- Raises:
ValueError – If any duplicates are detected.