:py:mod:`eelib.utils.simulation_setup.helper_create_sim` ======================================================== .. py:module:: eelib.utils.simulation_setup.helper_create_sim .. autoapi-nested-parse:: Helper functions for the generation of new simulations. | Author: elenia@TUBS | Copyright 2024 elenia | This file is part of eELib, which is free software under the terms of the GNU GPL Version 3. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: eelib.utils.simulation_setup.helper_create_sim.get_architecture_models eelib.utils.simulation_setup.helper_create_sim.create_excel_for_models eelib.utils.simulation_setup.helper_create_sim.read_excel_for_models eelib.utils.simulation_setup.helper_create_sim.create_excel_for_same_models eelib.utils.simulation_setup.helper_create_sim.read_excel_for_same_models eelib.utils.simulation_setup.helper_create_sim.read_profiles_from_grid eelib.utils.simulation_setup.helper_create_sim.create_model_data eelib.utils.simulation_setup.helper_create_sim.create_dict_from_grid eelib.utils.simulation_setup.helper_create_sim.create_grid_model_config eelib.utils.simulation_setup.helper_create_sim.create_input_file eelib.utils.simulation_setup.helper_create_sim.create_sim_config_str_from_model_data eelib.utils.simulation_setup.helper_create_sim.create_sim_script eelib.utils.simulation_setup.helper_create_sim.move_files_to_testing .. py:function:: get_architecture_models() -> list[str] Reads the list of superordinate models to connect to each other and every HEMS. This list is stored in eelib/model_connections/architecture_models.json. :raises FileNotFoundError: If the architecture models file is not found. :raises TypeError: If the content of the architecture models file is not a list. :returns: List of superordinate models to connect to each other and every HEMS. :rtype: list[str] .. py:function:: create_excel_for_models(models_dict: dict, has_grid: bool = True, bool_same_models: bool = False, no_sheets: list = ['Forecast', 'Pandapower', 'Powerfactory'], no_params: list = ['step_size', 'n_steps'], model_data: dict[str, pandas.DataFrame] = dict()) Create excel with sheets for all existing models and their parameters. :param models_dict: Info about eElib models and their parameters. :type models_dict: dict :param has_grid: Wants to place the entities in a grid. :type has_grid: bool :param bool_same_models: If models can have all the same entities. Defaults to False. :type bool_same_models: bool :param no_sheets: Listing of all model types that do not need a sheet, because they are created differently/separately. Defaults to ["Forecast", "Pandapower", "Powerfactory"]. :type no_sheets: list :param no_params: Listing of all parameters that are not filled for the model but given otherwise (e.g. from scenario). Defaults to ["step_size", "n_steps"]. :type no_params: list :param model_data: Pre-filled model_data (e.g. from grid profiles) to be filled into the excel. :type model_data: dict[str, pd.DataFrame] :raises ValueError: If identical parameterisation is used in combination with grid profiles. .. py:function:: read_excel_for_models(models_dict: dict) -> dict Create dict of model data from information in excel on all model types. :param models_dict: info about existing models and their parameters :type models_dict: dict :returns: info on all models/entities for the simulation :rtype: dict .. py:function:: create_excel_for_same_models(model_data: dict) Create excel with sheets for all named models with 1 entity to possibly multiply them. :param model_data: info on models for the simulation :type model_data: dict .. py:function:: read_excel_for_same_models(model_data: dict) -> dict Create dict of model data from existent data and information on same models at loadbuses. :param model_data: info on models for the simulation :type model_data: dict :returns: info on all entities for the simulation :rtype: dict .. py:function:: read_profiles_from_grid(grid: pandapower.auxiliary.pandapowerNet, profile_unit: str) -> dict ``grid.load.profile`` might contain a reference to one load profile per loadbus. For every profile specified in ``grid.load.profile``, reads those profiles from ``grid.profiles``, stores them under examples/data_input/load. In SimBench, references starting with "H" mark Households. Everything else is industrial. Despite that, everything is parameterised as a ``HouseholdsCSV``. Alerts, when a CSVReader at that loadbus is already specified. :param grid: The grid used in the simulation. :type grid: pandapowerNet :param profile_unit: Unit of profiles stored in ``grid.profiles`` ("W", "kW"). :type profile_unit: str :returns: Dict in the format of ``model_data`` to update the existing ``model_data``. :rtype: dict .. py:function:: create_model_data(model_data: dict, store: bool = False) -> dict Create dict for model data with information on all model parameterizations. :param model_data: info on all entities for the simulation :type model_data: dict :param store: Whether to store the config file into "model_data.json". Defaults to False. :type store: bool :returns: model data information for the simulation :rtype: dict .. py:function:: create_dict_from_grid(grid: pandapower.auxiliary.pandapowerNet | None = None, store: bool = False) -> dict Create dict for grid simulations with entities at specific load buses. :param grid: pandapower grid object. Defaults to None. :type grid: pandapowerNet | None :param store: Whether to store the config file into "grid.json". Defaults to False. :type store: bool :returns: grid information for the simulation :rtype: dict .. py:function:: create_grid_model_config(model_data: dict, grid: pandapower.auxiliary.pandapowerNet | None = None, store: bool = False) -> dict Create dict for connections for grid simulations with entities at specific load buses. :param model_data: info on all entities for the simulation and their loadbuses :type model_data: dict :param grid: Corresponding grid. Defaults to None. :type grid: pandapowerNet | None :param store: Whether to store the config file into "grid_model_config.json". Defaults to False. :type store: bool :returns: connection config information for the simulation :rtype: dict .. py:function:: create_input_file(model_data: dict, name: str, grid: pandapower.auxiliary.pandapowerNet | None = None, grid_parameters: dict = {}, store_single_files: bool = False) -> None Create full input file for simulations. :param model_data: info on all entities for the simulation and their loadbuses :type model_data: dict :param name: name to store the file for, extension ".json" will be added :type name: str :param grid: pandapower grid object. Defaults to None. :type grid: pandapowerNet | None :param grid_parameters: information on all grid parameters :type grid_parameters: dict :param store_single_files: Whether to also store the information into separate files. Defaults to False. :type store_single_files: bool :returns: Returns nothing. :rtype: None .. py:function:: create_sim_config_str_from_model_data(models_dict: dict, model_names_list: list, sc_parameters: eelib.data.dataclass.SimScriptConfigParams, out_attributes: dict = dict()) -> str Create the string for SIM_CONFIG as part of the scenario script using the entered model data. :param models_dict: information about all eELib model, including class and valid parameters :type models_dict: dict :param model_names_list: listing of the names of all used models :type model_names_list: list :param sc_parameters: parameters for the scenario configuration :type sc_parameters: SimScriptConfigParams :param out_attributes: dict[model_name: list[attributes of this model to store in DB]] :type out_attributes: dict :returns: string representing the SIM_CONFIG part of the scenario script :rtype: str .. py:function:: create_sim_script(models_dict: dict, model_names_list: list, sc_param: eelib.data.dataclass.SimScriptConfigParams, out_attributes: dict = dict()) Create and store a python script to run a configured scenario simulation. :param models_dict: information about all eELib model, including class and valid parameters :type models_dict: dict :param model_names_list: listing of the names of all used models :type model_names_list: list :param sc_param: parameters for the scenario configuration :type sc_param: SimScriptConfigParams :param out_attributes: dict[model_name: list[attributes of this model to store in DB]] :type out_attributes: dict .. py:function:: move_files_to_testing(scenario_name: str, dir_input: str, dir_scenario: str) Moves scenario files to their respective directories using pathlib. :param scenario_name: The name of the scenario. :type scenario_name: str :param dir_input: The directory to move the JSON file to. :type dir_input: str :param dir_scenario: The directory to move the Python script to. :type dir_scenario: str