flexmeasures.data.models.planning.linear_optimization

Functions

flexmeasures.data.models.planning.linear_optimization.device_scheduler(device_constraints: list[pd.DataFrame], ems_constraints: pd.DataFrame, commitment_quantities: list[pd.Series], commitment_downwards_deviation_price: list[pd.Series] | list[float], commitment_upwards_deviation_price: list[pd.Series] | list[float], initial_stock: float = 0) tuple[list[pd.Series], float, SolverResults, ConcreteModel]

This generic device scheduler is able to handle an EMS with multiple devices, with various types of constraints on the EMS level and on the device level, and with multiple market commitments on the EMS level. A typical example is a house with many devices. The commitments are assumed to be with regard to the flow of energy to the device (positive for consumption, negative for production). The solver minimises the costs of deviating from the commitments.

Device constraints are on a device level. Handled constraints (listed by column name):

max: maximum stock assuming an initial stock of zero (e.g. in MWh or boxes) min: minimum stock assuming an initial stock of zero equal: exact amount of stock (we do this by clamping min and max) efficiency: amount of stock left at the next datetime (the rest is lost) derivative max: maximum flow (e.g. in MW or boxes/h) derivative min: minimum flow derivative equals: exact amount of flow (we do this by clamping derivative min and derivative max) derivative down efficiency: conversion efficiency of flow out of a device (flow out : stock decrease) derivative up efficiency: conversion efficiency of flow into a device (stock increase : flow in) stock delta: predefined stock delta to apply to the storage device. Positive values cause an increase and negative values a decrease

EMS constraints are on an EMS level. Handled constraints (listed by column name):

derivative max: maximum flow derivative min: minimum flow

Commitments are on an EMS level. Parameter explanations:
commitment_quantities: amounts of flow specified in commitments (both previously ordered and newly requested)
  • e.g. in MW or boxes/h

commitment_downwards_deviation_price: penalty for downwards deviations of the flow
  • e.g. in EUR/MW or EUR/(boxes/h)

  • either a single value (same value for each flow value) or a Series (different value for each flow value)

commitment_upwards_deviation_price: penalty for upwards deviations of the flow

All Series and DataFrames should have the same resolution.

For now, we pass in the various constraints and prices as separate variables, from which we make a MultiIndex DataFrame. Later we could pass in a MultiIndex DataFrame directly.