eelib.core.control.dems.dems_model

Base class for DEMS models.

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

Classes

DEMS

Models a district energy managament system on level of a residential district (quarter).

class DEMS(eid: str, step_size: int, scenario_config: dict[str, object], strategy: str = 'surplus', forecast_horizon_hours: int = 24, forecast_frequency_hours: int = 24, forecast_type: str = 'district_only')

Bases: object

Models a district energy managament system on level of a residential district (quarter).

forecast_types
_VALID_PARAMETERS
eid
step_size
strategy = "'surplus'"
scenario_config
contr_entities_by_eid
contr_fullid_list_by_type
cs_data: dict[str, eelib.data.dataclass.CSData]
bss_data: dict[str, eelib.data.dataclass.BSSData]
hp_data: dict[str, eelib.data.dataclass.HPData]
tes_data: dict[str, eelib.data.dataclass.TESData]
pv_data: dict[str, eelib.data.dataclass.PVData]
p
q
p_rated
p_rated_pv = '0.0'
e_annual
p_min = 'None'
p_max = 'None'
p_demand = 'None'
p_generation = 'None'
p_balance = 'None'
q_balance = 'None'
p_set_storage
p_set_pv
p_set_charging_station
p_th_water
p_th_room
p_th_dem
p_th_gen
grid_status
control_signal = 'None'
control_cache
flex_signal
p_th_balance = '0'
e_th = '0'
p_th_need_step = '0'
p_th_set_heatpump
p_th_set_storage
timestep = '0'
tariff: eelib.data.dataclass.TariffData | None = 'None'
tariff_step_elec_price = 'None'
tariff_step_feed_in = 'None'
cache_capacity_used = '[]'
cost = '0.0'
revenue = '0.0'
profit = '0.0'
forecast_type = "'district_only'"
bool_forecast_now = 'False'
bool_schedule_now = 'False'
forecast_start = '0'
forecast_end = '0'
forecast_horizon
forecast_frequency
forecast_request
forecast
forecast_cache
schedule
classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

add_controlled_entity(entities_dict: dict)

Adds a controlled entity to the corresponding DEMS’s lists (controlled components and type-specific).

Parameters:

entities_dict (dict) – Input list with all models of a type (e.g. charging_station) which will be connected to the controller.

_get_component_by_type(type: str) dict

Gets all controlled components of passed type.

Parameters:

type (str) – Query to determine all controlled components of this type.

Returns:

Returns all entities of queried type.

Return type:

dict

step(timestep: int)

Handles stepping of district energy managament systems.

Parameters:

timestep (int) – Current simulation time

_calc_p_rated_pv()

Accounts the installed PV peak power (p_rated) of all different connected PV models, and stores it in a class wide attriute (in W).

_calc_power_energy(newly_arrived: bool)

Gathers current power flows, aggregates limits, and calculates energy balances.

Parameters:

newly_arrived (bool) – whether this is the first call of all methods in this timestep

_set_pv_max()

Calculate PV system setpoints for all devices by using the maximum power.

_set_cs_p()

Calculate charging station setpoints using the uncontrolled charging strategy.

_set_hp_p_th()

Calculate heatpump thermal power setpoints by reducing needed power at this step.

_set_tes_p_th()

Calculate thermal energy storage setpoint regarding DEMS’ thermal power balance and e_th. Thermal power of TES shall be within its limits.

_set_bss_p()

Calculate battery storage system setpoints for all devices using the chosen strategy.

_reset_financial_values()

Reset all financial values (at the beginning of a new timestep).

_calc_feed_in_progressive() float

Based on the progressive tariff that specifies a lower bound of DER power, and the corresponding value as the applicable tariff, calculates and returns the total resulting feed_in_tariff for this DEMS.

Returns:

Total resulting feed_in_tariff

Return type:

float

_handle_incoming_signals()

Retrieve tariff settings for this step and control limitations from incoming signals.

_calc_financial_output()

Calculate financial values like cost, profit and revenue for this timestep.

_strategy_surplus()
_strategy_optimal()
_update_forecast() None

Updates the existing forecast cache with possibly new incoming forecast values.

Returns:

Nothing to return

Return type:

None

_request_forecast()

Set models with their attributes and time horizon for forecast request.

_set_schedule_values()

Take schedules of the devices and convert them into set values.

_set_power_in_limits(power: float, p_min: float, p_max: float) float

Set a power value with regard to a maximum and minimum value, if given.

Parameters:
  • power (float) – current power value to start with

  • p_min (float) – minimum power limit

  • p_max (float) – maximum power limit

Returns:

power value within the limiting bounds

Return type:

float

_set_schedule_values_pv()

Take schedules of PV systems and convert them to set values by using the power limits.

_set_schedule_values_cs()

Take schedules of charging stations and convert to set values by using the limits.

_set_schedule_values_hp()

Take schedules of heatpumps and convert them to set values by using the power limits.

_set_schedule_values_bss()

Take schedules of battery storage systems and convert to set values using the limits.

_set_schedule_values_tes()

Take schedules of thermal energy storage and convert to set values using the limits.