:py:mod:`eelib.core.control.dems.dems_model` ============================================ .. py:module:: eelib.core.control.dems.dems_model .. autoapi-nested-parse:: 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 ~~~~~~~ .. autoapisummary:: eelib.core.control.dems.dems_model.DEMS .. py: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: :py:obj:`object` Models a district energy managament system on level of a residential district (quarter). .. py:attribute:: forecast_types .. py:attribute:: _VALID_PARAMETERS .. py:attribute:: eid .. py:attribute:: step_size .. py:attribute:: strategy :value: "'surplus'" .. py:attribute:: scenario_config .. py:attribute:: contr_entities_by_eid .. py:attribute:: contr_fullid_list_by_type .. py:attribute:: cs_data :type: dict[str, eelib.data.dataclass.CSData] .. py:attribute:: bss_data :type: dict[str, eelib.data.dataclass.BSSData] .. py:attribute:: hp_data :type: dict[str, eelib.data.dataclass.HPData] .. py:attribute:: tes_data :type: dict[str, eelib.data.dataclass.TESData] .. py:attribute:: pv_data :type: dict[str, eelib.data.dataclass.PVData] .. py:attribute:: p .. py:attribute:: q .. py:attribute:: p_rated .. py:attribute:: p_rated_pv :value: '0.0' .. py:attribute:: e_annual .. py:attribute:: p_min :value: 'None' .. py:attribute:: p_max :value: 'None' .. py:attribute:: p_demand :value: 'None' .. py:attribute:: p_generation :value: 'None' .. py:attribute:: p_balance :value: 'None' .. py:attribute:: q_balance :value: 'None' .. py:attribute:: p_set_storage .. py:attribute:: p_set_pv .. py:attribute:: p_set_charging_station .. py:attribute:: p_th_water .. py:attribute:: p_th_room .. py:attribute:: p_th_dem .. py:attribute:: p_th_gen .. py:attribute:: grid_status .. py:attribute:: control_signal :value: 'None' .. py:attribute:: control_cache .. py:attribute:: flex_signal .. py:attribute:: p_th_balance :value: '0' .. py:attribute:: e_th :value: '0' .. py:attribute:: p_th_need_step :value: '0' .. py:attribute:: p_th_set_heatpump .. py:attribute:: p_th_set_storage .. py:attribute:: timestep :value: '0' .. py:attribute:: tariff :type: eelib.data.dataclass.TariffData | None :value: 'None' .. py:attribute:: tariff_step_elec_price :value: 'None' .. py:attribute:: tariff_step_feed_in :value: 'None' .. py:attribute:: cache_capacity_used :value: '[]' .. py:attribute:: cost :value: '0.0' .. py:attribute:: revenue :value: '0.0' .. py:attribute:: profit :value: '0.0' .. py:attribute:: forecast_type :value: "'district_only'" .. py:attribute:: bool_forecast_now :value: 'False' .. py:attribute:: bool_schedule_now :value: 'False' .. py:attribute:: forecast_start :value: '0' .. py:attribute:: forecast_end :value: '0' .. py:attribute:: forecast_horizon .. py:attribute:: forecast_frequency .. py:attribute:: forecast_request .. py:attribute:: forecast .. py:attribute:: forecast_cache .. py:attribute:: schedule .. py:method:: get_valid_parameters() -> dict :classmethod: Returns dictionary containing valid parameter types and values. :returns: valid parameters for this model :rtype: dict .. py:method:: add_controlled_entity(entities_dict: dict) Adds a controlled entity to the corresponding DEMS's lists (controlled components and type-specific). :param entities_dict: Input list with all models of a type (e.g. charging_station) which will be connected to the controller. :type entities_dict: dict .. py:method:: _get_component_by_type(type: str) -> dict Gets all controlled components of passed type. :param type: Query to determine all controlled components of this type. :type type: str :returns: Returns all entities of queried type. :rtype: dict .. py:method:: step(timestep: int) Handles stepping of district energy managament systems. :param timestep: Current simulation time :type timestep: int .. py:method:: _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). .. py:method:: _calc_power_energy(newly_arrived: bool) Gathers current power flows, aggregates limits, and calculates energy balances. :param newly_arrived: whether this is the first call of all methods in this timestep :type newly_arrived: bool .. py:method:: _set_pv_max() Calculate PV system setpoints for all devices by using the maximum power. .. py:method:: _set_cs_p() Calculate charging station setpoints using the uncontrolled charging strategy. .. py:method:: _set_hp_p_th() Calculate heatpump thermal power setpoints by reducing needed power at this step. .. py:method:: _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. .. py:method:: _set_bss_p() Calculate battery storage system setpoints for all devices using the chosen strategy. .. py:method:: _reset_financial_values() Reset all financial values (at the beginning of a new timestep). .. py:method:: _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 :rtype: float .. py:method:: _handle_incoming_signals() Retrieve tariff settings for this step and control limitations from incoming signals. .. py:method:: _calc_financial_output() Calculate financial values like cost, profit and revenue for this timestep. .. py:method:: _strategy_surplus() .. py:method:: _strategy_optimal() .. py:method:: _update_forecast() -> None Updates the existing forecast cache with possibly new incoming forecast values. :returns: Nothing to return :rtype: None .. py:method:: _request_forecast() Set models with their attributes and time horizon for forecast request. .. py:method:: _set_schedule_values() Take schedules of the devices and convert them into set values. .. py:method:: _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. :param power: current power value to start with :type power: float :param p_min: minimum power limit :type p_min: float :param p_max: maximum power limit :type p_max: float :returns: power value within the limiting bounds :rtype: float .. py:method:: _set_schedule_values_pv() Take schedules of PV systems and convert them to set values by using the power limits. .. py:method:: _set_schedule_values_cs() Take schedules of charging stations and convert to set values by using the limits. .. py:method:: _set_schedule_values_hp() Take schedules of heatpumps and convert them to set values by using the power limits. .. py:method:: _set_schedule_values_bss() Take schedules of battery storage systems and convert to set values using the limits. .. py:method:: _set_schedule_values_tes() Take schedules of thermal energy storage and convert to set values using the limits.