annular.market.tulipa.config ============================ .. py:module:: annular.market.tulipa.config Attributes ---------- .. autoapisummary:: annular.market.tulipa.config.logger Exceptions ---------- .. autoapisummary:: annular.market.tulipa.config.TulipaConfigError Classes ------- .. autoapisummary:: annular.market.tulipa.config._TulipaConfig Module Contents --------------- .. py:data:: logger .. py:exception:: TulipaConfigError(msg) Bases: :py:obj:`Exception` Exception raised when the TulipaConfig configuration has issues. :param msg: Explanation of the error. .. py:attribute:: message .. py:class:: _TulipaConfig(input_data_folder: pathlib.Path | str, julia_environment: pathlib.Path | str, communication_folder: pathlib.Path | str, db_path: pathlib.Path | str, debug_input_folder: pathlib.Path | str | None = None) Container for Tulipa configuration. The container is used inside Annular to pass data from the simulation configuration to Tulipa. It contains configuration from the parameters defined via the `tulipa_config_file` key in the muscle3 configuration file, and additional data for internal logic. :param input_data_folder: Path to data defining the Tulipa model. :param julia_environment: Path to Julia project environment, passed to Julia as the `--project` argument. :param communication_folder: Folder that stores data that are sent between annular and Tulipa. Needs to be a new folder, and it is deleted at cleanup. :param db_path: Path to the database file. :param debug_input_folder: Path to folder to keep database tables as csv files for debugging. Should exist inside communication_folder. Details: Data for communication (config file, input data, duckdb file) are deleted at cleanup. However, if debug_input_folder is given, the communication folder is persisted after cleanup. .. py:attribute:: input_data_folder .. py:attribute:: julia_environment .. py:attribute:: communication_folder .. py:attribute:: db_path .. py:attribute:: debug_input_folder .. py:method:: from_config(input_data_folder: pathlib.Path | str, self_base_folder: pathlib.Path | str, julia_environment: pathlib.Path | str, communication_folder: pathlib.Path | str | None = None, iteration_id: None | int = None, db_file: str = 'tulipa.duckdb') :classmethod: Create a _TulipaConfig class from a configuration file. :param input_data_folder: Path to data defining the Tulipa model, interpreted relative to `self_base_folder`. :param self_base_folder: The path to the `tulipa_config_file`. Used internally to find the path to the `input_data_folder`. :param julia_environment: Path to Julia project environment, passed to Julia as the `--project` argument. Interpreted relative to `self_base_folder`. :param communication_folder: Folder that stores data that are sent between Annular and Tulipa. Needs to be a new folder, and it is deleted at cleanup. By default, a directory `./.tulipa-communication-0` is used in the location of the main python process. Otherwise, the path is interpreted relative to the location of `self_base_folder`. :param iteration_id: Identifier of the iteration. If given, used for creating unique communication folders for each invocation of the market model in a multi-period annular simulation. :param db_file: Name of the database file inside `communication_folder`. :raises TulipaConfigError: When (i) `input_data_folder` does not exist, (ii) `communication_folder` already exists, or (iii) the provided project environment for Julia cannot be found. .. py:property:: config_file :type: pathlib.Path Yaml file for communicating settings from python to Julia. .. py:method:: _validate_julia_env(environment: pathlib.Path, base_folder: pathlib.Path) -> pathlib.Path :staticmethod: .. py:method:: write_to_yaml() Write config to yaml, converting Path objects to strings. .. py:method:: cleanup() Remove database and temp dir.