midas.scenario package¶
Subpackages¶
Submodules¶
midas.scenario.configurator module¶
This module contains the configurator for midas scenarios.
-
class
midas.scenario.configurator.Configurator(scenario_name, params=None, custom_cfg=None, ini_path=None)¶ Bases:
objectThis is the main configurator for midas scenarios.
The configurator takes at least a scenario name to create a fully- configured mosaik scenario.
- Parameters
scenario_name (str) – A str containing the name of the scenario_name which should be run.
params (dict) – A dict with the pre-configuration for the scenario. Can be empty.
config (str) – A string containing the path to a custom config file.
-
custom_cfg¶ Stores the path to the custom configuration if provided
- Type
str
-
params¶ A dict containing the configuration of the scenario. The dict is extended during the configuration.
- Type
dict
-
scenario¶ A dict containing references to everything that is created during the configuration of the senario.
- Type
dict
-
scenario_name¶ The name of the scenario created
- Type
str
-
_apply_modules(scenario, params)¶ Apply all required modules in the correct order.
-
_load_configs(dirpath, files)¶ Load the config files with yaml.
-
_normalize(params)¶ Apply some auto corrections for the parameter dictionary.
Corrects, e.g., the end definition ‘15*60’ to 900.
-
_organize_params(configs)¶ Sort params in correct order.
-
_save_config(name, params)¶ Save a copy of the current config.
-
configure(ini_path=None, data_path=None)¶ Configure the midas scenario.
Will use the information provided during initialization.
- Returns
A dict containing everything that was defined during configuration.
- Return type
dict
-
run()¶ Run the scenario configured before.
midas.scenario.upgrade_module module¶
This module contains the abstract base class for all upgrade modules. Provides a basic workflow for the definition of new upgrades.
-
class
midas.scenario.upgrade_module.UpgradeModule(name, log=None)¶ Bases:
abc.ABCBase class for upgrade modules.
-
_start_simulator()¶ Start a certain simulator instance.
-
abstract
check_module_params()¶ Is called from within the upgrade method.
-
abstract
check_sim_params(module_params, **kwargs)¶ Is called from within the upgrade method.
-
abstract
connect()¶
-
connect_entities(from_entity, to_entity, attrs)¶ Connect the attrs of two entities.
-
abstract
connect_to_db()¶
-
start_model(mod_key, mod_name, params)¶
-
abstract
start_models()¶
-
upgrade(scenario, params)¶ Upgrade the scenario with this module.
Adds the functionality provided by this upgrade to the scenario, i.e., define and start a simulator in the mosaik world, instantiate models, and add connections to other existing models.
- Parameters
scenario (dict) – The scenario dict containing reference to everything created in former upgrades.
params (dict) – A dict containing the content of the config files and additional information generated during other upgrades.
-