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] | None = None, commitment_downwards_deviation_price: list[pd.Series] | list[float] | None = None, commitment_upwards_deviation_price: list[pd.Series] | list[float] | None = None, commitments: list[pd.DataFrame] | list[Commitment] | None = None, initial_stock: float | list[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.
- Parameters:
device_constraints – 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 – EMS constraints are on an EMS level. Handled constraints (listed by column name): derivative max: maximum flow derivative min: minimum flow
commitments – Commitments are on an EMS level by default. Handled parameters (listed by column name): quantity: for example, 5.5 downwards deviation price: 10.1 upwards deviation price: 10.2 group: 1 (defaults to the enumerate time step j) device: 0 (corresponds to device d; if not set, commitment is on an EMS level)
initial_stock – initial stock for each device. Use a list with the same number of devices as device_constraints, or use a single value to set the initial stock to be the same for all devices.
- Potentially deprecated arguments:
- 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
Separate costs for each commitment are stored in a dictionary under model.commitment_costs (indexed by commitment).
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.