agentlib_flexquant package
agentlib plugin
Subpackages
- agentlib_flexquant.data_structures package
- Submodules
- agentlib_flexquant.data_structures.flex_kpis module
FlexibilityData
FlexibilityData.electricity_price_series
FlexibilityData.flex_offer_time_grid
FlexibilityData.kpis_neg
FlexibilityData.kpis_pos
FlexibilityData.mpc_time_grid
FlexibilityData.power_profile_base
FlexibilityData.power_profile_flex_neg
FlexibilityData.power_profile_flex_pos
FlexibilityData.stored_energy_profile_base
FlexibilityData.stored_energy_profile_flex_neg
FlexibilityData.stored_energy_profile_flex_pos
FlexibilityData.switch_time
FlexibilityData.Config
FlexibilityData.calculate()
FlexibilityData.format_mpc_inputs()
FlexibilityData.format_predictor_inputs()
FlexibilityData.get_kpis()
FlexibilityKPIs
FlexibilityKPIs.corrected_costs
FlexibilityKPIs.corrected_costs_rel
FlexibilityKPIs.costs
FlexibilityKPIs.costs_rel
FlexibilityKPIs.direction
FlexibilityKPIs.electricity_costs_series
FlexibilityKPIs.energy_flex
FlexibilityKPIs.power_flex_full
FlexibilityKPIs.power_flex_offer
FlexibilityKPIs.power_flex_offer_avg
FlexibilityKPIs.power_flex_offer_max
FlexibilityKPIs.power_flex_offer_min
FlexibilityKPIs.power_flex_within_boundary
FlexibilityKPIs.calculate()
FlexibilityKPIs.get_kpi_dict()
FlexibilityKPIs.get_name_dict()
KPI
KPISeries
- agentlib_flexquant.data_structures.flex_offer module
- agentlib_flexquant.data_structures.flex_results module
Results
Results.baseline_agent_config
Results.baseline_module_config
Results.convert_timescale_of_dataframe_index()
Results.create_instance_with_skipped_validation()
Results.current_timescale_of_data
Results.df_baseline
Results.df_baseline_stats
Results.df_indicator
Results.df_market
Results.df_neg_flex
Results.df_neg_flex_stats
Results.df_pos_flex
Results.df_pos_flex_stats
Results.df_simulation
Results.generator_config
Results.get_intersection_mpcs_sim()
Results.indicator_agent_config
Results.indicator_module_config
Results.market_agent_config
Results.market_module_config
Results.neg_flex_agent_config
Results.neg_flex_module_config
Results.pos_flex_agent_config
Results.pos_flex_module_config
Results.simulator_agent_config
Results.simulator_module_config
load_indicator()
load_market()
- agentlib_flexquant.data_structures.flexquant module
FlexQuantConfig
FlexQuantConfig.baseline_config_generator_data
FlexQuantConfig.delete_files
FlexQuantConfig.flex_base_directory_path
FlexQuantConfig.flex_event_duration
FlexQuantConfig.flex_files_directory
FlexQuantConfig.indicator_config
FlexQuantConfig.market_config
FlexQuantConfig.market_time
FlexQuantConfig.overwrite_files
FlexQuantConfig.prep_time
FlexQuantConfig.results_directory
FlexQuantConfig.shadow_mpc_config_generator_data
FlexQuantConfig.adapt_paths_and_create_directory
FlexQuantConfig.check_config_file_extension
FlexibilityIndicatorConfig
FlexibilityMarketConfig
ForcedOffers
ShadowMPCConfigGeneratorConfig
- agentlib_flexquant.data_structures.globals module
- agentlib_flexquant.data_structures.market module
- agentlib_flexquant.data_structures.mpcs module
BaseMPCData
BaseMPCData.class_name
BaseMPCData.config_inputs_appendix
BaseMPCData.config_parameters_appendix
BaseMPCData.created_flex_mpcs_file
BaseMPCData.module_id
BaseMPCData.module_types
BaseMPCData.name_of_created_file
BaseMPCData.power_alias
BaseMPCData.results_suffix
BaseMPCData.stored_energy_alias
BaseMPCData.weights
BaselineMPCData
BaselineMPCData.class_name
BaselineMPCData.comfort_variable
BaselineMPCData.config_inputs_appendix
BaselineMPCData.config_parameters_appendix
BaselineMPCData.module_id
BaselineMPCData.module_types
BaselineMPCData.name_of_created_file
BaselineMPCData.power_alias
BaselineMPCData.power_unit
BaselineMPCData.power_variable
BaselineMPCData.profile_comfort_weight
BaselineMPCData.profile_deviation_weight
BaselineMPCData.results_suffix
BaselineMPCData.stored_energy_alias
BaselineMPCData.weights
BaselineMPCData.update_config_parameters_appendix
NFMPCData
PFMPCData
- agentlib_flexquant.modules package
- Submodules
- agentlib_flexquant.modules.baseline_mpc module
- agentlib_flexquant.modules.flexibility_indicator module
FlexibilityIndicatorModule
FlexibilityIndicatorModule.calc_and_send_offer()
FlexibilityIndicatorModule.callback()
FlexibilityIndicatorModule.check_power_end_deviation()
FlexibilityIndicatorModule.cleanup_results()
FlexibilityIndicatorModule.data
FlexibilityIndicatorModule.get_results()
FlexibilityIndicatorModule.process()
FlexibilityIndicatorModule.register_callbacks()
FlexibilityIndicatorModule.send_flex_offer()
FlexibilityIndicatorModule.write_results()
FlexibilityIndicatorModuleConfig
FlexibilityIndicatorModuleConfig.calculate_costs
FlexibilityIndicatorModuleConfig.correct_costs
FlexibilityIndicatorModuleConfig.inputs
FlexibilityIndicatorModuleConfig.outputs
FlexibilityIndicatorModuleConfig.parameters
FlexibilityIndicatorModuleConfig.power_unit
FlexibilityIndicatorModuleConfig.price_variable
FlexibilityIndicatorModuleConfig.results_file
FlexibilityIndicatorModuleConfig.save_results
FlexibilityIndicatorModuleConfig.shared_variable_fields
FlexibilityIndicatorModuleConfig.check_results_file_extension
FlexibilityIndicatorModuleConfig.model_post_init()
InputsForCalculateFlexCosts
InputsForCorrectFlexCosts
- agentlib_flexquant.modules.flexibility_market module
FlexibilityMarketModule
FlexibilityMarketModule.cleanup_results()
FlexibilityMarketModule.custom_flexibility_callback()
FlexibilityMarketModule.df
FlexibilityMarketModule.dummy_callback()
FlexibilityMarketModule.end
FlexibilityMarketModule.get_results()
FlexibilityMarketModule.process()
FlexibilityMarketModule.random_flexibility_callback()
FlexibilityMarketModule.register_callbacks()
FlexibilityMarketModule.set_random_seed()
FlexibilityMarketModule.single_flexibility_callback()
FlexibilityMarketModule.write_results()
FlexibilityMarketModuleConfig
FlexibilityMarketModuleConfig.inputs
FlexibilityMarketModuleConfig.market_specs
FlexibilityMarketModuleConfig.outputs
FlexibilityMarketModuleConfig.results_file
FlexibilityMarketModuleConfig.save_results
FlexibilityMarketModuleConfig.shared_variable_fields
FlexibilityMarketModuleConfig.check_results_file_extension
FlexibilityMarketModuleConfig.model_post_init()
- agentlib_flexquant.modules.shadow_mpc module
- agentlib_flexquant.optimization_backends package
- agentlib_flexquant.utils package
- Submodules
- agentlib_flexquant.utils.config_management module
- agentlib_flexquant.utils.data_handling module
- agentlib_flexquant.utils.interactive module
- agentlib_flexquant.utils.parsing module
SetupSystemModifier
SetupSystemModifier.mpc_data
SetupSystemModifier.get_leftmost_list()
SetupSystemModifier.modify_config_class_baseline()
SetupSystemModifier.modify_config_class_shadow()
SetupSystemModifier.modify_setup_system_baseline()
SetupSystemModifier.modify_setup_system_shadow()
SetupSystemModifier.visit_ClassDef()
SetupSystemModifier.visit_Module()
add_import_to_tree()
add_input()
add_output()
add_parameter()
create_ast_element()
remove_all_imports_from_tree()
Submodules
agentlib_flexquant.generate_flex_agents module
- class agentlib_flexquant.generate_flex_agents.FlexAgentGenerator(flex_config: str | Annotated[Path, PathType(path_type=file)] | FlexQuantConfig, mpc_agent_config: str | Annotated[Path, PathType(path_type=file)] | AgentConfig)[source]
Bases:
object
- adapt_indicator_config(module_config: FlexibilityIndicatorModuleConfig) FlexibilityIndicatorModuleConfig [source]
Adapts the indicator module config for automated flexibility quantification.
- adapt_market_config(module_config: FlexibilityMarketModuleConfig) FlexibilityMarketModuleConfig [source]
Adapts the market module config for automated flexibility quantification.
- adapt_mpc_module_config(module_config: BaseMPCConfig, mpc_dataclass: BaseMPCData) BaseMPCConfig [source]
Adapts the mpc module config for automated flexibility quantification. Things adapted among others are: - the file name/path of the mpc config file - names of the control variables for the shadow mpcs - reduce communicated variables of shadow mpcs to outputs - add the power variable to the outputs - add the Time variable to the inputs - add parameters for the activation and quantification of flexibility
- adapt_sim_results_path(simulator_agent_config: str | Path) dict [source]
Optional helper function to adapt file path for simulator results in sim config so that sim results land in the same results directory as flex results. :param simulator_agent_config: Path to the simulator agent config JSON file. :type simulator_agent_config: Union[str, Path]
- Returns:
The updated simulator config with the modified result file path.
- Return type:
dict
- Raises:
FileNotFoundError – If the specified config file does not exist.
- append_module_and_dump_agent(module: BaseModuleConfig, agent: AgentConfig, module_type: str, config_name: str)[source]
Appends the given module config to the given agent config and dumps the agent config to a json file. The json file is named based on the config_name.
- baseline_mpc_module_config: BaseMPCConfig
- check_variables_in_casadi_config(config: CasadiModelConfig, expr: str)[source]
Check if all variables in the expression are defined in the config.
- Parameters:
config (CasadiModelConfig) – casadi model config.
expr (str) – The expression to check.
- Raises:
ValueError – If any variable in the expression is not defined in the config.
- generate_flex_agents() [<class 'agentlib_mpc.modules.mpc.BaseMPCConfig'>, <class 'agentlib_mpc.modules.mpc.BaseMPCConfig'>, <class 'agentlib_mpc.modules.mpc.BaseMPCConfig'>, <class 'agentlib_flexquant.modules.flexibility_indicator.FlexibilityIndicatorModuleConfig'>, <class 'agentlib_flexquant.modules.flexibility_market.FlexibilityMarketModuleConfig'>] [source]
Generates the configs and the python module for the flexibility agents. Power variable must be defined in the mpc config.
- indicator_module_config: FlexibilityIndicatorModuleConfig
- market_module_config: FlexibilityMarketModuleConfig
- neg_flex_mpc_module_config: BaseMPCConfig
- orig_mpc_module_config: BaseMPCConfig
- pos_flex_mpc_module_config: BaseMPCConfig
- run_config_validations()[source]
Function to validate integrity of user-supplied flex config.
The following checks are performed: 1. Ensures the specified power variable exists in the MPC model outputs. 2. Ensures the specified comfort variable exists in the MPC model states. 3. Validates that the stored energy variable exists in MPC outputs if energy cost correction is enabled. 4. Verifies the supported collocation method is used; otherwise, switches to ‘legendre’ and raises a warning. 5. Ensures that the sum of prep time, market time, and flex event duration does not exceed the prediction horizon. 6. Ensures market time equals the MPC model time step if market config is present. 7. Ensures that all flex time values are multiples of the MPC model time step. 8. Checks for mismatches between time-related parameters in the flex/MPC and indicator configs and issues warnings when discrepancies exist, using the flex/MPC config values as the source of truth.