eelib.core.control.hems.hems_helper.schedule_helper

Helper functions for the creation of schedules in EMS.

Pyomo released under 3-clause BSD license

Author: elenia@TUBS
Copyright 2024 elenia
This file is part of eELib, which is free software under the terms of the GNU GPL Version 3.

Module Contents

Functions

calc_forecast_residual(→ numpy.ndarray)

Calculates the residual forecast for the "p"-values of all devices' forecasts.

calc_forecast_thermal_residual(→ numpy.ndarray)

Calculates the residual forecast for the thermal demand ("p_th"-values).

bss_calc_schedule(→ dict)

Calculates the schedule for the p_set values of the bss.

pv_calc_schedule(→ dict)

Calculates the schedule for all pv systems using the forecast (maximum power).

hp_calc_schedule(→ dict)

Calculates the schedule for the thermal power set values of the heatpump.

cs_calc_schedule(→ dict)

Calculates the schedule for all connected charging stations and its connected cars.

calc_schedule_opt(, tariff, cs_data, bss_data, ...)

Calculates an optimal schedule for all connected devices.

Attributes

_logger

_logger
calc_forecast_residual(forecast: dict, forecast_horizon: int) numpy.ndarray

Calculates the residual forecast for the “p”-values of all devices’ forecasts.

Parameters:
  • forecast (dict) – input forecasts to calculate schedule

  • forecast_horizon (int) – timesteps in which forecast is created

Returns:

residual electrical power values from forecasts for attribute “p” for devices

Return type:

np.ndarray

calc_forecast_thermal_residual(forecast: dict, forecast_horizon: int) numpy.ndarray

Calculates the residual forecast for the thermal demand (“p_th”-values).

Parameters:
  • forecast (dict) – input forecasts to calculate schedule

  • forecast_horizon (int) – timesteps in which forecast is created

Returns:

residual thermal demand values from forecast

Return type:

np.ndarray

bss_calc_schedule(step_size: int, schedule_p_res: list, bss_data: dict[str, eelib.data.dataclass.BSSData]) dict

Calculates the schedule for the p_set values of the bss.

Parameters:
  • step_size (int) – simulation step_size

  • schedule_p_res (list) – Input schedule of residual load.

  • bss_data (dict[str, BSSData]) – Battery information at start of forecast. Structure is {id: BSSData}

Returns:

Schedule with p_set values of the bss in the forecast horizon.

Return type:

dict

pv_calc_schedule(forecast: dict, pv_data: dict) dict

Calculates the schedule for all pv systems using the forecast (maximum power).

Parameters:
  • forecast (dict) – collected forecast from EMS

  • pv_data (dict) – contains all information of pv systems with structure {id: PVData}

Returns:

Schedule with power set values of the pv systems in the forecast horizon.

Return type:

dict

hp_calc_schedule(step_size: int, th_demand_profile: list, energy_demand_th: float, hp_data: dict) dict

Calculates the schedule for the thermal power set values of the heatpump.

Parameters:
  • step_size (int) – simulation step_size

  • th_demand_profile (list) – input profile of the thermal power demand.

  • energy_demand_th (float) – current thermic energy demand

  • hp_data (dict) – contains all information of heatpumps with structure {id: HPData}

Returns:

Schedule with thermal and electrical set values of the hps in the forecast horizon.

Return type:

dict

cs_calc_schedule(step_size: int, forecast: dict, forecast_horizon: int, cs_data: dict, cs_strategy: str, timestep: int) dict

Calculates the schedule for all connected charging stations and its connected cars. Uses the forecast of the appereance and the cars consumption. NOTE: For this schedule the car is always charged with max. power.

Parameters:
  • step_size (int) – simulation step size in seconds

  • forecast (dict) – collected forecast from EMS

  • forecast_horizon (int) – length of the forecast period

  • cs_data (dict) – contains all information of charging stations with structure {id: CSData}

  • cs_strategy (str) – strategy for cs’ forecast schedule

  • timestep (int) – timestep at creation of schedule/forecast

Returns:

Schedule with power set values of the charging stations in the forecast horizon.

Return type:

dict

calc_schedule_opt(step_size: int, timestep: int, forecast: dict, forecast_horizon: int, opt: eelib.data.dataclass.OptimOptions = OptimOptions(), tariff: eelib.data.dataclass.TariffData = TariffData(), cs_data: dict = {}, bss_data: dict = {}, pv_data: dict = {}, hp_data: dict = {}, tes_data: dict = {}, control_signals: eelib.data.dataclass.ControlSignal = ControlSignal()) dict

Calculates an optimal schedule for all connected devices.

Be careful when using this function in a HEMS strategy, as this only presents an example of an optimization. Optimization models often tend to be buggy when used with various input data during simulations, so it may happen that an optimization turns out to be infeasible or even unbounded. This function as currently constructed cannot handle such output and will lead to stoppage in the simulation. Infeasible optimization problems do contain a set of (at least 2) constraints that contradict each other, leading to no feasible/possible solution - e.g. the initial BSS SoC for step 1 is set to 4.9 %, although the minimum energy constraint states that the energy level at all timesteps should be >= 5 %. Unbounded optimization models occur, when there is always a solution with a higher objective function value - e.g. when (for a certain timestep) the electricity costs are lower than the feedin tariff and simultaneous increase of demand and feedin always yields a higher profit value.

Parameters:
  • step_size (int) – simulation step_size

  • timestep (int) – simulation step for which the schedule should start

  • forecast (dict) – collected forecasts from EMS

  • forecast_horizon (int) – timesteps for which forecast should be calculated

  • opt (OptimOptions) – information about optimization setup (whats used and what not)

  • tariff (TariffData) – electricity price signal. Defaults to TariffData().

  • cs_data (dict) – info of charging stations, like {id: CSData}. Defaults to {}.

  • bss_data (dict) – info of battery storage systems, like {id: BSSData}. Defaults to {}.

  • pv_data (dict) – info of pv systems, like {id: PVData}. Defaults to {}.

  • hp_data (dict) – info of heatpumps, like {id: HPData}. Defaults to {}.

  • tes_data (dict) – info of thermal energy storages, like {id: TESData}. Defaults to {}.

  • control_signals (ControlSignal) – Control signals sent to EMS with lists for power limits.

Raises:
  • ValueError – constructed optimization problem could not be solved by solver

  • UserWarning – If a given capacity fee horizon does not fit to the forecast/schedule horizon.

Returns:

Schedule with power set values of the connected devices in the forecast horizon.

Return type:

dict