flexmeasures.data.models.planning.process

Classes

class flexmeasures.data.models.planning.process.ProcessScheduler(sensor: Sensor | None = None, start: datetime | None = None, end: datetime | None = None, resolution: timedelta | None = None, belief_time: datetime | None = None, asset_or_sensor: Asset | Sensor | None = None, round_to_decimals: int | None = 6, flex_model: dict | None = None, flex_context: dict | None = None, return_multiple: bool = False)
block_invalid_starting_times_for_whole_process_scheduling(process_type: ProcessType, time_restrictions: Series, duration: timedelta, rows_to_fill: int) Series
Blocks time periods where the process cannot be schedule into, making

sure no other time restrictions runs in the middle of the activation of the process

More technically, this function applying an erosion of the time_restrictions array with a block of length duration.

Then, the condition if time_restrictions.sum() == len(time_restrictions):, makes sure that at least we have a spot to place the process.

For example:

time_restriction = [1 0 0 1 1 1 0 0 1 0]

# applying a dilation with duration = 2 time_restriction = [1 0 1 1 1 1 0 1 1 1]

We can only fit a block of duration = 2 in the positions 1 and 6. sum(start_time_restrictions) == 8, while the len(time_restriction) == 10, which means we have 10-8=2 positions.

Parameters:
  • process_type – INFLEXIBLE, SHIFTABLE or BREAKABLE

  • time_restrictions – boolean time series indicating time periods in which the process cannot be scheduled.

  • duration – (datetime) duration of the length

  • rows_to_fill – (int) time periods that the process lasts

Returns:

filtered time restrictions

compute() pd.Series | None

Schedule a process, defined as a power and a duration, within the specified time window. To schedule a battery, please, refer to the StorageScheduler.

For example, this scheduler can plan the start of a process of type SHIFTABLE that lasts 5h and requires a power of 10kW. In that case, the scheduler will find the best (as to minimize/maximize the cost) hour to start the process.

This scheduler supports three types of process_types:
  • INFLEXIBLE: this process needs to be scheduled as soon as possible.

  • BREAKABLE: this process can be divisible in smaller consumption periods.

  • SHIFTABLE: this process can start at any time within the specified time window.

The resulting schedule provides the power flow at each time period.

Parameters

consumption_price_sensor: it defines the utility (economic, environmental, ) in each

time period. It has units of quantity/energy, for example, EUR/kWh.

power: nominal power of the process. duration: time that the process last.

optimization_direction: objective of the scheduler, to maximize or minimize. time_restrictions: time periods in which the process cannot be schedule to. process_type: INFLEXIBLE, BREAKABLE or SHIFTABLE.

returns:

The computed schedule.

compute_breakable(schedule: Series, optimization_direction: OptimizationDirection, time_restrictions: Series, cost: DataFrame, rows_to_fill: int, power: float) None

Break up schedule and divide it over the time slots with the largest utility (max/min cost depending on optimization_direction).

compute_inflexible(schedule: Series, time_restrictions: Series, rows_to_fill: int, power: float) None

Schedule process as early as possible.

compute_shiftable(schedule: Series, optimization_direction: OptimizationDirection, time_restrictions: Series, cost: DataFrame, rows_to_fill: int, power: float) None

Schedules a block of consumption/production of rows_to_fill periods to maximize a utility.

deserialize_flex_config()

Deserialize flex_model using the schema ProcessSchedulerFlexModelSchema and flex_context using FlexContextSchema