agentlib_flexquant.data_structures package

Submodules

agentlib_flexquant.data_structures.flex_kpis module

Module for representing and calculating flexibility KPIs. It defines Pydantic models for scalar and time-series KPIs, and provides methods to compute power, energy, and cost metrics for positive and negative flexibility scenarios.

pydantic model agentlib_flexquant.data_structures.flex_kpis.FlexibilityData[source]

Bases: BaseModel

Class containing the data for the calculation of the flexibility.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field electricity_price_series: Series = None

Profile of the electricity price

field flex_offer_time_grid: ndarray = None

Time grid of the flexibility offer

field kpis_neg: FlexibilityKPIs = FlexibilityKPIs(direction='negative', power_flex_full=KPISeries(name='power_flex_full', value=None, unit='kW', direction='negative', dt=None, integration_method='linear'), power_flex_offer=KPISeries(name='power_flex_offer', value=None, unit='kW', direction='negative', dt=None, integration_method='linear'), power_flex_offer_max=KPI(name='power_flex_offer_max', value=None, unit='kW', direction='negative'), power_flex_offer_min=KPI(name='power_flex_offer_min', value=None, unit='kW', direction='negative'), power_flex_offer_avg=KPI(name='power_flex_offer_avg', value=None, unit='kW', direction='negative'), energy_flex=KPI(name='energy_flex', value=None, unit='kWh', direction='negative'), power_flex_within_boundary=KPI(name='power_flex_within_boundary', value=None, unit='-', direction='negative'), electricity_costs_series=KPISeries(name='electricity_costs_series', value=None, unit='ct/h', direction='negative', dt=None, integration_method='linear'), costs=KPI(name='costs', value=None, unit='ct', direction='negative'), corrected_costs=KPI(name='corrected_costs', value=None, unit='ct', direction='negative'), costs_rel=KPI(name='costs_rel', value=None, unit='ct/kWh', direction='negative'), corrected_costs_rel=KPI(name='corrected_costs_rel', value=None, unit='ct/kWh', direction='negative'))

KPIs for negative flexibility

field kpis_pos: FlexibilityKPIs = FlexibilityKPIs(direction='positive', power_flex_full=KPISeries(name='power_flex_full', value=None, unit='kW', direction='positive', dt=None, integration_method='linear'), power_flex_offer=KPISeries(name='power_flex_offer', value=None, unit='kW', direction='positive', dt=None, integration_method='linear'), power_flex_offer_max=KPI(name='power_flex_offer_max', value=None, unit='kW', direction='positive'), power_flex_offer_min=KPI(name='power_flex_offer_min', value=None, unit='kW', direction='positive'), power_flex_offer_avg=KPI(name='power_flex_offer_avg', value=None, unit='kW', direction='positive'), energy_flex=KPI(name='energy_flex', value=None, unit='kWh', direction='positive'), power_flex_within_boundary=KPI(name='power_flex_within_boundary', value=None, unit='-', direction='positive'), electricity_costs_series=KPISeries(name='electricity_costs_series', value=None, unit='ct/h', direction='positive', dt=None, integration_method='linear'), costs=KPI(name='costs', value=None, unit='ct', direction='positive'), corrected_costs=KPI(name='corrected_costs', value=None, unit='ct', direction='positive'), costs_rel=KPI(name='costs_rel', value=None, unit='ct/kWh', direction='positive'), corrected_costs_rel=KPI(name='corrected_costs_rel', value=None, unit='ct/kWh', direction='positive'))

KPIs for positive flexibility

field mpc_time_grid: ndarray = None

Time grid of the mpcs

field power_profile_base: Series = None

Base power profile

field power_profile_flex_neg: Series = None

Power profile of the negative flexibility

field power_profile_flex_pos: Series = None

Power profile of the positive flexibility

field stored_energy_profile_base: Series = None

Base profile of the stored electrical energy

field stored_energy_profile_flex_neg: Series = None

Profile of the stored electrical energy for negative flexibility

field stored_energy_profile_flex_pos: Series = None

Profile of the stored elctrical energy for positive flexibility

field switch_time: float | None = None

Time of the switch between the preparation and the market time

class Config[source]

Bases: object

Allow arbitrary (non-Pydantic) types such as pandas.Series or numpy.ndarray in model fields without requiring custom validators.

arbitrary_types_allowed = True
calculate(enable_energy_costs_correction: bool, calculate_flex_cost: bool, integration_method: Literal['linear', 'constant'], collocation_time_grid: list = None)[source]

Calculate the KPIs for the positive and negative flexibility.

Parameters:
  • enable_energy_costs_correction – whether the energy costs should be corrected

  • calculate_flex_cost – whether the cost of the flexibility should be calculated

  • integration_method – method used for integration of KPISeries e.g. linear, constant

  • collocation_time_grid – Time grid of the mpc output with collocation discretization

get_kpis() dict[str, agentlib_flexquant.data_structures.flex_kpis.KPI][source]

Return combined KPIs from positive and negative flexibility scenarios.

reset_time_grid()[source]

Reset the common time grid. This should be called between different flexibility calculations.

unify_inputs(series: Series, mpc=True) Series[source]

Format the input of the mpc to unify the data.

Parameters:

series – Input series from a mpc.

Returns:

Formatted series.

pydantic model agentlib_flexquant.data_structures.flex_kpis.FlexibilityKPIs[source]

Bases: BaseModel

Class defining the indicator KPIs.

Fields:
field corrected_costs: KPI = KPI(name='corrected_costs', value=None, unit='ct', direction=None)

Corrected costs of flexibility considering the stored energy in the system

field corrected_costs_rel: KPI = KPI(name='corrected_costs_rel', value=None, unit='ct/kWh', direction=None)

Corrected costs of flexibility per energy

field costs: KPI = KPI(name='costs', value=None, unit='ct', direction=None)

Costs of flexibility

field costs_rel: KPI = KPI(name='costs_rel', value=None, unit='ct/kWh', direction=None)

Costs of flexibility per energy

field direction: Literal['positive', 'negative'] = None

Direction of the shadow mpc

field electricity_costs_series: KPISeries = KPISeries(name='electricity_costs_series', value=None, unit='ct/h', direction=None, dt=None, integration_method='linear')

Costs of flexibility

field energy_flex: KPI = KPI(name='energy_flex', value=None, unit='kWh', direction=None)

Energy flexibility equals the integral of the power flexibility

field power_flex_full: KPISeries = KPISeries(name='power_flex_full', value=None, unit='kW', direction=None, dt=None, integration_method='linear')

Power flexibility

field power_flex_offer: KPISeries = KPISeries(name='power_flex_offer', value=None, unit='kW', direction=None, dt=None, integration_method='linear')

Power flexibility

field power_flex_offer_avg: KPI = KPI(name='power_flex_offer_avg', value=None, unit='kW', direction=None)

Average power flexibility

field power_flex_offer_max: KPI = KPI(name='power_flex_offer_max', value=None, unit='kW', direction=None)

Maximum power flexibility

field power_flex_offer_min: KPI = KPI(name='power_flex_offer_min', value=None, unit='kW', direction=None)

Minimum power flexibility

field power_flex_within_boundary: KPI = KPI(name='power_flex_within_boundary', value=None, unit='-', direction=None)

Variable indicating whether the baseline power and flex power align at the horizon end

calculate(power_profile_base: Series, power_profile_shadow: Series, electricity_price_series: Series, mpc_time_grid: ndarray, flex_offer_time_grid: ndarray, stored_energy_base: Series, stored_energy_shadow: Series, enable_energy_costs_correction: bool, calculate_flex_cost: bool, integration_method: Literal['linear', 'constant'], collocation_time_grid: list = None)[source]

Calculate the KPIs based on the power and electricity price input profiles.

Parameters:
  • power_profile_base – power profile from baseline mpc

  • power_profile_shadow – power profile from shadow mpc

  • electricity_price_series – time series of electricity prices

  • flex_offer_time_grid – time grid over which the flexibility offer is calculated,

  • profiles (for indexing of the power flexibility) –

  • stored_energy_base – time series of stored energy from baseline mpc

  • stored_energy_shadow – time series of stored energy from shadow mpc

  • enable_energy_costs_correction – whether the energy costs should be corrected

  • calculate_flex_cost – whether the cost of the flexibility should be calculated

  • integration_method – method used for integration of KPISeries e.g. linear, constant

  • collocation_time_grid – Time grid of the mpc output with collocation discretization

get_kpi_dict(identifier: bool = False) dict[str, agentlib_flexquant.data_structures.flex_kpis.KPI][source]

Get the KPIs as a dictionary with names or identifier as keys.

Parameters:
  • identifier – If True, the keys are the identifiers of the KPIs,

  • KPI. (otherwise the name of the) –

Returns:

A dictionary mapping desired KPI keys to KPI.

get_name_dict() dict[str, str][source]

Get KPIs mapping.

Returns:

Dictionary of the kpis with names as keys and the identifiers as values.

pydantic model agentlib_flexquant.data_structures.flex_kpis.KPI[source]

Bases: BaseModel

Class defining attributes of the indicator KPI.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field direction: Literal['positive', 'negative'] | None = None

Direction of the shadow mpc / flexibility

field name: str = None

Name of the flexibility KPI

field unit: str = None

Unit of the flexibility KPI

field value: float | None = None

Value of the flexibility KPI

class Config[source]

Bases: object

Allow arbitrary (non-Pydantic) types such as pandas.Series or numpy.ndarray in model fields without requiring custom validators.

arbitrary_types_allowed = True
get_kpi_identifier()[source]

Get the identifier of the KPI composed of the direction of the flexibility and the KPI name.

pydantic model agentlib_flexquant.data_structures.flex_kpis.KPISeries[source]

Bases: KPI

Class defining extra attributes of the indicator KPISeries in addition to KPI.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field dt: Series | None = None

Time differences between the timestamps of the series in seconds

field integration_method: Literal['linear', 'constant'] = 'linear'

Method set to integrate series variable

field value: Series | None = None

Value of the flexibility KPI

avg() float[source]

Calculate the average value of the KPISeries over time.

integrate(time_unit: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds') float[source]

Integrate the value of the KPISeries over time by summing up the product of values and the time difference.

Parameters:

time_unit – The time unit the integrated value should have

Returns:

The integrated value of the KPISeries

max() float[source]

Get the maximum of a KPISeries.

min() float[source]

Get the minimum of a KPISeries.

agentlib_flexquant.data_structures.flex_offer module

Data models for flexibility offers.

This module defines data structures for representing flexibility offers in energy markets, including baseline power profiles, positive and negative flexibility pricing, and offer status tracking. The FlexOffer class encapsulates all information needed to represent a flexibility bid, including power differences from baseline and acceptance status.

pydantic model agentlib_flexquant.data_structures.flex_offer.FlexOffer[source]

Bases: BaseModel

Data class for the flexibility offer.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field base_power_profile: Series = None

Power profile of the baseline MPC

field neg_diff_profile: Series = None

Power profile for the negative difference

field neg_price: float | None = None

Price for negative flexibility

field pos_diff_profile: Series = None

Power profile for the positive difference

field pos_price: float | None = None

Price for positive flexibility

field status: OfferStatus = 'Not Accepted'

Status of the FlexOffer

class Config[source]

Bases: object

Allow arbitrary (non-Pydantic) types such as pandas.Series or numpy.ndarray in model fields without requiring custom validators.

arbitrary_types_allowed = True
as_dataframe() DataFrame[source]

Store the flexibility offer in a pd.DataFrame

Returns:

DataFrame containing the flexibility offer. Scalar values are written on the first timestep.

class agentlib_flexquant.data_structures.flex_offer.OfferStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Status of the FlexOffer

ACCEPTED_NEGATIVE = 'Accepted Negative'
ACCEPTED_POSITIVE = 'Accepted Positive'
NOT_ACCEPTED = 'Not Accepted'

agentlib_flexquant.data_structures.flex_results module

Module for generating and managing results dataframes for flexibility analysis. Results include baseline, positive and negative flexibility data, the indicator, market and simulator results/data.

class agentlib_flexquant.data_structures.flex_results.Results(flex_config: str | Path | dict | None, simulator_agent_config: str | Path | dict | None, generated_flex_files_base_path: str | Path | None = None, results: str | Path | dict[str, dict[str, pandas.core.frame.DataFrame]] | Results | None = None, to_timescale: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds')[source]

Bases: object

Loads the results for the baseline, positive and negative flexibility, the indicator, market and simulator results/data. Additionally the MPC stats are loaded.

Results can be loaded either from a user-specified custom base path or from the (default) base path specified in the flex config.

Loaded results are stored in pandas DataFrames which can be used for further processing, e.g. plotting and analysis.

baseline_agent_config: AgentConfig
baseline_module_config: BaseMPCConfig
convert_timescale_of_dataframe_index(to_timescale: Literal['seconds', 'minutes', 'hours', 'days'])[source]

Convert the time in the dataframes to the desired timescale

Parameters:

to_timescale – The timescale to convert the data to

create_instance_with_skipped_validation(model_class: Type[BaseModel], config: Dict[str, Any], skip_fields: list[str] | None = None) BaseModel[source]

Create a Pydantic model instance while skipping validation for specified fields.

This function allows partial validation of a model’s config dictionary by validating all fields except those listed in skip_fields. Skipped fields are set on the instance after construction without triggering their validators.

Parameters:
  • model_class – The Pydantic model class to instantiate.

  • config – The input configuration dictionary.

  • skip_fields – A list of field names to exclude from validation.

  • instantiation. (These fields will be manually set after) –

Returns:

An instance of the model_class with validated and skipped fields assigned.

Return type:

BaseModel

current_timescale_of_data: Literal['seconds', 'minutes', 'hours', 'days'] = 'seconds'
df_baseline: DataFrame
df_baseline_stats: DataFrame
df_indicator: DataFrame
df_market: DataFrame
df_neg_flex: DataFrame
df_neg_flex_stats: DataFrame
df_pos_flex: DataFrame
df_pos_flex_stats: DataFrame
df_simulation: DataFrame
generator_config: FlexQuantConfig
get_intersection_mpcs_sim() dict[str, dict[str, str]][source]

Get the intersection of the MPCs and the simulator variables.

Returns:

Key: variable alias (from baseline)

Value: {module id: variable name}

Return type:

dictionary with the following structure

indicator_agent_config: AgentConfig
indicator_module_config: FlexibilityIndicatorModuleConfig
market_agent_config: AgentConfig
market_module_config: FlexibilityMarketModuleConfig
neg_flex_agent_config: AgentConfig
neg_flex_module_config: BaseMPCConfig
pos_flex_agent_config: AgentConfig
pos_flex_module_config: BaseMPCConfig
simulator_agent_config: AgentConfig
simulator_module_config: SimulatorConfig
agentlib_flexquant.data_structures.flex_results.load_indicator(file_path: str | Path) DataFrame[source]

Load the flexibility indicator results from the given file path.

Parameters:

file_path – the file path of the indicator results file

Returns:

DataFrame containing the indicator results

agentlib_flexquant.data_structures.flex_results.load_market(file_path: str | Path) DataFrame[source]

Load the market results from the given file path.

Parameters:

file_path – the file path of the market results file

Returns:

DataFrame containing the market results

agentlib_flexquant.data_structures.flexquant module

Pydantic data models for FlexQuant configuration and validation.

pydantic model agentlib_flexquant.data_structures.flexquant.FlexQuantConfig[source]

Bases: BaseModel

Class defining the options to initialize the FlexQuant generation.

Config:
  • json_encoders: dict = {<class ‘pathlib.Path’>: <class ‘str’>}

  • extra: str = forbid

Fields:
Validators:
field baseline_config_generator_data: BaselineMPCData [Required]

Baseline generator data config file or dict

Validated by:
field casadi_sim_time_step: int = 0

Simulate over the prediction horizon with a defined resolution using Casadi simulator. Only use it when the power depends on the states. Don’t use it when power itself is the control variable.Set to 0 to skip simulation

Validated by:
field delete_files: bool = True

If generated files should be deleted afterwards

Validated by:
field flex_base_directory_path: Path | None [Optional]

Base path where generated flex data is stored

Validated by:
field flex_event_duration: int = 7200

Flexibility event duration

Constraints:
  • ge = 0

Validated by:
field flex_files_directory: Path = PosixPath('created_flex_files')

Directory where generated files (jsons) should be stored

Validated by:
field indicator_config: FlexibilityIndicatorConfig | Path [Required]

Path to the file or dict of flexibility indicator config

Validated by:
field market_config: FlexibilityMarketConfig | Path | None = None

Path to the file or dict of market config

Validated by:
field market_time: int = 900

Time for market interaction

Constraints:
  • ge = 0

Validated by:
field overwrite_files: bool = False

If generated files should be overwritten by new files

Validated by:
field prep_time: int = 1800

Preparation time before the flexibility event

Constraints:
  • ge = 0

Validated by:
field results_directory: Path = PosixPath('results')

Directory where generated result files (CSVs) should be stored

Validated by:
field shadow_mpc_config_generator_data: ShadowMPCConfigGeneratorConfig [Required]

Shadow mpc generator data config file or dict

Validated by:
validator adapt_paths_and_create_directory  »  all fields[source]

Adjust and ensure the directory structure for flex file generation and results storage.

This method: - Updates flex_files_directory and results_directory paths, so they are relative to the base flex directory, using only the directory names (ignoring any user-supplied paths). - Creates the base, flex files, and results directories if they do not already exist.

validator check_config_file_extension  »  all fields[source]

Validate that the indicator and market config file paths have a ‘.json’ extension.

Raises:

ValueError – If either file does not have the expected ‘.json’ extension.

validator is_none_negative_integer  »  casadi_sim_time_step[source]
pydantic model agentlib_flexquant.data_structures.flexquant.FlexibilityIndicatorConfig[source]

Bases: BaseModel

Class defining the options for the flexibility indicators.

Config:
  • json_encoders: dict = {<class ‘pathlib.Path’>: <class ‘str’>, <class ‘agentlib.core.agent.AgentConfig’>: <function FlexibilityIndicatorConfig.<lambda> at 0x7f66bda702c0>}

  • extra: str = forbid

Fields:
Validators:
field agent_config: AgentConfig [Required]
Validated by:
field name_of_created_file: str = 'indicator.json'

Name of the config that is created by the generator

Validated by:
validator check_file_extension  »  all fields[source]

Validate that name_of_created_file has a .json extension.

pydantic model agentlib_flexquant.data_structures.flexquant.FlexibilityMarketConfig[source]

Bases: BaseModel

Class defining the options to initialize the market.

Config:
  • extra: str = forbid

Fields:
field agent_config: AgentConfig [Required]
field name_of_created_file: str = 'flexibility_market.json'

Name of the config that is created by the generator

pydantic model agentlib_flexquant.data_structures.flexquant.ShadowMPCConfigGeneratorConfig[source]

Bases: BaseModel

Class defining the options to initialize the shadow mpc config generation.

Config:
  • json_encoders: dict = {<class ‘agentlib_mpc.data_structures.mpc_datamodels.MPCVariable’>: <function ShadowMPCConfigGeneratorConfig.<lambda> at 0x7f66bda23f60>}

  • extra: str = forbid

Fields:
Validators:
field neg_flex: NFMPCData = None

Data for NF-MPC

Validated by:
field pos_flex: PFMPCData = None

Data for PF-MPC

Validated by:
field weights: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []

Name and value of weights

Validated by:
validator assign_weights_to_flex  »  all fields[source]

Validate flexibility cost function fields and assign weights to them.

agentlib_flexquant.data_structures.globals module

Script containing global variables

agentlib_flexquant.data_structures.globals.return_baseline_cost_function(power_variable: str, comfort_variable: str) str[source]

Return baseline cost function

Parameters:
  • power_variable – name of the power variable

  • comfort_variable – name of the comfort variable

Returns:

Cost function in the baseline mpc, obj_std is to be evaluated according to user definition

agentlib_flexquant.data_structures.market module

Market specification data models for flexibility offer acceptance strategies.

Defines Pydantic models for configuring different market behaviors including random acceptance, single offer acceptance, and custom strategies with associated parameters and validation.

pydantic model agentlib_flexquant.data_structures.market.CustomOptions[source]

Bases: BaseModel

Configuration options for custom market behavior with flexible parameters.

Config:
  • extra: str = allow

Fields:
field type: Literal['custom'] [Required]
pydantic model agentlib_flexquant.data_structures.market.MarketSpecifications[source]

Bases: BaseModel

Base specification for flexibility market behavior and parameters.

Fields:
Validators:
field accepted_offer_sample_points: Literal['collocation', 'constant'] = 'collocation'

Method defining how to send the accepted flexibility power backto the baseline mpc so that the system can deliver it. This is relevant for collocation, as the power profile is only defined at the collocation points. If you choose constant here, the values are averaged and set for the whole time step.Set to constant if the power only depends on control or if system has low inertial. Otherwise, use collocation.

Validated by:
field cooldown: int = 6

cooldown time (no timesteps) after a provision

Validated by:
field minimum_average_flex: float = 0

minimum average of an accepted offer

Validated by:
field options: RandomOptions | SingleOptions | CustomOptions [Required]

Market options, changes depending on ‘type’

Validated by:
field type: str = None

Name of market type

Validated by:
validator set_options_type  »  all fields[source]

Automatically set the options type field from the top-level market type.

pydantic model agentlib_flexquant.data_structures.market.RandomMarket[source]

Bases: MarketSpecifications

Market specification for random flexibility offer acceptance behavior.

Fields:
Validators:

field type: str = 'random'
Validated by:
pydantic model agentlib_flexquant.data_structures.market.RandomOptions[source]

Bases: BaseModel

Configuration options for random market behavior.

Fields:
field offer_acceptance_rate: float = 0.5

Determines the likelihood of an accepted offer

Constraints:
  • ge = 0

  • le = 1

field pos_neg_rate: float = 0

Determines the likelihood positive and the negative flexibility.A higher rate means that more positive offers will be accepted.

Constraints:
  • ge = 0

  • le = 1

field random_seed: int = None

Random seed for reproducing experiments

field type: Literal['random'] [Required]
pydantic model agentlib_flexquant.data_structures.market.SingleOptions[source]

Bases: BaseModel

Configuration options for single offer acceptance market behavior.

Fields:
field direction: Literal['positive', 'negative'] = 'positive'

Direction of the flexibility

field offer_acceptance_time: float [Required]

After this time, the first available flex offer is accepted

field type: Literal['single'] [Required]

agentlib_flexquant.data_structures.mpcs module

Data models for MPC configurations in flexibility quantification.

This module defines Pydantic data models that encapsulate configuration parameters for baseline, positive flexibility, and negative flexibility MPC controllers used in flexquant. The models handle file paths, module configurations, variable mappings, and optimization weights for MPC implementations.

pydantic model agentlib_flexquant.data_structures.mpcs.BaseMPCData[source]

Bases: BaseModel

Base class containing necessary data for the code creation of the different mpcs

Config:
  • json_encoders: dict = {<class ‘agentlib_mpc.data_structures.mpc_datamodels.MPCVariable’>: <function BaseMPCData.<lambda> at 0x7f66bda22e80>}

Fields:
field class_name: str [Required]
field config_inputs_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []
field config_parameters_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []
field created_flex_mpcs_file: str = 'flex_agents.py'
field module_id: str [Required]
field module_types: dict [Required]
field name_of_created_file: str [Required]
field power_alias: str [Required]
field results_suffix: str [Required]
field stored_energy_alias: str [Required]
field weights: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []

Name and value of weights

pydantic model agentlib_flexquant.data_structures.mpcs.BaselineMPCData[source]

Bases: BaseMPCData

Data class for Baseline MPC

Config:
  • json_encoders: dict = {<class ‘agentlib_mpc.data_structures.mpc_datamodels.MPCVariable’>: <function BaselineMPCData.<lambda> at 0x7f66bda22fc0>}

Fields:
Validators:
field class_name: str = 'BaselineMPCModel'
Validated by:
field comfort_variable: str = None

Name of the slack variable representing the thermal comfort in the baseline config

Validated by:
field config_inputs_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = [MPCVariable(name='_P_external', type=None, timestamp=None, unit='W', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='_P_external', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>), MPCVariable(name='in_provision', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=False, alias='in_provision', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>), MPCVariable(name='rel_start', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='rel_start', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>), MPCVariable(name='rel_end', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='rel_end', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>)]
Validated by:
field config_parameters_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []
Validated by:
field module_id: str = 'Baseline'
Validated by:
field module_types: dict = {'agentlib_mpc.minlp_mpc': 'agentlib_flexquant.baseline_minlp_mpc', 'agentlib_mpc.mpc': 'agentlib_flexquant.baseline_mpc'}
Validated by:
field name_of_created_file: str = 'baseline.json'
Validated by:
field power_alias: str = '_P_el_base'
Validated by:
field power_unit: str = 'kW'

Unit of the power variable

Validated by:
field power_variable: str = 'P_el'

Name of the variable representing the electrical power in the baseline config

Validated by:
field profile_comfort_weight: float = 1

Weight of soft constraint for discomfort

Validated by:
field profile_deviation_weight: float = 0

Weight of soft constraint for deviation from accepted flexible profile

Validated by:
field results_suffix: str = '_base.csv'
Validated by:
field stored_energy_alias: str = '_E_stored_base'
Validated by:
field weights: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []

Name and value of weights

Validated by:
validator update_config_parameters_appendix  »  all fields[source]

Update the config parameters appendix with profile deviation and comfort weights.

Adds the profile deviation weight parameter and optionally the profile comfort weight parameter (if comfort_variable is enabled) to the config_parameters_appendix list as MPCVariable instances.

pydantic model agentlib_flexquant.data_structures.mpcs.NFMPCData[source]

Bases: BaseMPCData

Data class for PF-MPC

Config:
  • json_encoders: dict = {<class ‘agentlib_mpc.data_structures.mpc_datamodels.MPCVariable’>: <function NFMPCData.<lambda> at 0x7f66bda23380>}

Fields:
field class_name: str = 'NegFlexModel'
field config_inputs_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = [MPCVariable(name='in_provision', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=False, alias='in_provision', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>)]
field config_parameters_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = [MPCVariable(name='prep_time', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='prep_time', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>), MPCVariable(name='market_time', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='market_time', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>), MPCVariable(name='flex_event_duration', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='flex_event_duration', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>)]
field flex_cost_function: str = None

Cost function of the NF-MPC

field module_id: str = 'NegFlexMPC'
field module_types: dict = {'agentlib_mpc.minlp_mpc': 'agentlib_flexquant.shadow_minlp_mpc', 'agentlib_mpc.mpc': 'agentlib_flexquant.shadow_mpc'}
field name_of_created_file: str = 'neg_flex.json'
field power_alias: str = '_P_el_neg'
field results_suffix: str = '_neg_flex.csv'
field stored_energy_alias: str = '_E_stored_neg'
field weights: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []

Name and value of weights

pydantic model agentlib_flexquant.data_structures.mpcs.PFMPCData[source]

Bases: BaseMPCData

Data class for PF-MPC

Config:
  • json_encoders: dict = {<class ‘agentlib_mpc.data_structures.mpc_datamodels.MPCVariable’>: <function PFMPCData.<lambda> at 0x7f66bda231a0>}

Fields:
field class_name: str = 'PosFlexModel'
field config_inputs_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = [MPCVariable(name='in_provision', type=None, timestamp=None, unit='Not defined', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=False, alias='in_provision', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>)]
field config_parameters_appendix: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = [MPCVariable(name='prep_time', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='prep_time', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>), MPCVariable(name='market_time', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='market_time', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>), MPCVariable(name='flex_event_duration', type=None, timestamp=None, unit='s', description='Not defined', ub=inf, lb=-inf, clip=False, allowed_values=[], value=0, alias='flex_event_duration', source=Source(agent_id=None, module_id=None), shared=None, rdf_class=None, interpolation_method=<InterpolationMethods.linear: 'linear'>)]
field flex_cost_function: str = None

Cost function of the PF-MPC

field module_id: str = 'PosFlexMPC'
field module_types: dict = {'agentlib_mpc.minlp_mpc': 'agentlib_flexquant.shadow_minlp_mpc', 'agentlib_mpc.mpc': 'agentlib_flexquant.shadow_mpc'}
field name_of_created_file: str = 'pos_flex.json'
field power_alias: str = '_P_el_pos'
field results_suffix: str = '_pos_flex.csv'
field stored_energy_alias: str = '_E_stored_pos'
field weights: list[agentlib_mpc.data_structures.mpc_datamodels.MPCVariable] = []

Name and value of weights