:py:mod:`eelib.data.dataclass.grid_info` ======================================== .. py:module:: eelib.data.dataclass.grid_info .. autoapi-nested-parse:: Dataclasses for grid information used in eELib. No testing is added for these functions and methods, as the grid info is quite specific for the use of links and entity infos in the eELib. This dataclass is only in use for the pandapower and powerfactory grid. During the setup of the simulation, the grid info is set up from the model entity and the linking in the input json file (via 'build_from'). Afterwards, the grid info is given to the grid ems to store the configuration/setup. | 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.data.dataclass.grid_info.EquipmentInfo eelib.data.dataclass.grid_info.GridInformation eelib.data.dataclass.grid_info.ComponentTypes Functions ~~~~~~~~~ .. autoapisummary:: eelib.data.dataclass.grid_info.convert_to_list eelib.data.dataclass.grid_info.retrieve_type .. py:class:: EquipmentInfo Combines the information about the equipment, that are important to the grid operator. Mainly information about the specification of a certain equipment (e.g. the rated apparent power, rated current, etc.) and the information about the links between the equipments. .. py:property:: sim_id :type: str Returns the simulator identifier. It is inferred, that the simulator identifier is the first half of the full identifier. :returns: The simulator identifier. :rtype: str .. py:property:: e_id :type: str Returns the entity identifier of underlying entity. :returns: The entity id. :rtype: str .. py:property:: full_id :type: str Returns the full identifier of the underlying entity. :returns: The identifier. :rtype: str .. py:method:: get_spec(with_name: str) -> None | Any Returns the specification with the given name. :param with_name: The name of the specification (e.g. "sn_va" for the nominal apparant power). :type with_name: str :returns: In case the equipment does not have the requested specification None is returned. In every other case the value of the specification is returned. :rtype: None | typing.Any .. py:method:: is_linked_to(entity: mosaik.scenario.Entity = None, fid: str = '') -> bool Checks, if the equipment is connected to an entity with the given full identifier. :param entity: A component entity. :type entity: Entity :param fid: The full identifier of the equipment. :type fid: str :returns: If the identifier is found in the list of connected equipment True, otherwise False. :rtype: bool .. py:method:: get_connected_ems() -> EquipmentInfo | None Returns the connected ems. :returns: If a ems is connected its informations are returned. Otherwise None is returned. :rtype: EquipmentInfo | None .. py:method:: is_connected_to_loadbus() -> bool Checks, if the equipment is connected to a loadbus. :returns: True, if it is connected to a loadbus. :rtype: bool .. py:method:: is_connected_to_ems() -> bool Checks, if the current component is connected to a ems. :returns: Is it connected to a ems? :rtype: bool .. py:method:: is_stub() -> bool Checks, if the current line is a direct connection to a household. :returns: For every other element False is returned. :rtype: bool .. py:method:: is_connected_to_stub() -> bool Checks, if the current component is connected to a stub/load line. :returns: True, if a stub is found in the list of linked components. :rtype: bool .. py:method:: get_stub() -> EquipmentInfo | None Returns the linked stub. :returns: None is returned, in case no stub is connected. :rtype: EquipmentInfo | None .. py:method:: get_loadbus() -> EquipmentInfo | None Returns the connected loadbus. :returns: The loadbus or None, if no loadbus is connected. :rtype: EquipmentInfo | None .. py:method:: get_any_bus() -> EquipmentInfo | None Returns the first encountered bus from the list of connected devices. :returns: Returns None if no equipment of type bus is connected. :rtype: EquipmentInfo | None .. py:method:: is_smart_ems() -> bool Checks, if the equipment is a smart EMS. :returns: True for all EMS models, that can send flex signals. :rtype: bool .. py:method:: count_connected_devices_loadbus(generator: bool, loads: bool) -> int Counts the directly connected devices to a loadbus. :param generator: Count generator devices like pv or bss. :type generator: bool :param loads: Count load devices like charging station, heatpumps, etc. :type loads: bool :returns: If this method is called on any other element then a loadbus, zero is returned. :rtype: int .. py:method:: count_connected_devices(generator: bool, loads: bool) -> int Counts the connected devices. :param generator: If set to True, counts all generators. :type generator: bool :param loads: If set to True, counts all loads. :type loads: bool :returns: The number of connected devices to a bus or a smart ems. :rtype: int .. py:method:: connect_equipment(equipment_info: EquipmentInfo) Connects to components. :param equipment_info: A equipment like a line, a heatpump, etc. :type equipment_info: EquipmentInfo .. py:method:: create_from(grid: mosaik.scenario.Entity, components_map: dict) -> list[EquipmentInfo] :staticmethod: Creates for each grid component an information object. It does not add the information about the connection between equipment. :param grid: The pandapower or powerfactory model entity. :type grid: Entity :param components_map: The components map of the specific model. :type components_map: dict :returns: Either the list with the informations or an empty list, when the grid entity is not of type 'Pandapower' or 'PowerFactory'. :rtype: list[EquipmentInfo] :raises ValueError: If it is intended to be created for a grid that is not from pandapower or powerfactory model .. py:method:: has_ext(component: dict, spec: str) -> bool :staticmethod: Checks, if the components dictionary contains the given specification in its static field. :param component: The dictionary of the component. :type component: dict :param spec: A specification like 'sn_va' for the nominal apparant power of a generator. :type spec: str :returns: Returns False, if no static field is found or the component does not have the specification. :rtype: bool .. py:method:: get(spec: str, from_component: dict) -> Any :staticmethod: Returns the value of the specification spec. It is assumed, that the component dictionary has a field 'static'. It also is assumed, that 'static' contains the 'spec' key. :param spec: A specification like the nominal apparant power 'sn_va'. :type spec: str :param from_component: The dictionary of the component. :type from_component: dict :returns: The value of the specification. :rtype: typing.Any .. py:class:: GridInformation Combines the information regarding the equipment of the grid and its topology. In addition to the information about the grid, the information about which load is represented by a ems is also stored. .. py:property:: entity_ids :type: list[str] Lists all entity identifiers. :returns: The entity ids. :rtype: list[str] .. py:method:: add(info: EquipmentInfo) Adds information to the grid informations. :param info: The information to add. :type info: EquipmentInfo .. py:method:: remove(info: EquipmentInfo) Removes the information from the grid information. In case the information is missing, nothing will be done. :param info: The information to remove. :type info: EquipmentInfo .. py:method:: get_info_by(entity_id: str = '', full_id: str = '', type: str = '') -> EquipmentInfo | None Retrieves the information with either the given entity_id or the full_id. :param entity_id: An entity identifier of a grid equipment. Defaults to "". :type entity_id: str, optional :param full_id: A full identifier of a grid equipment. Defaults to "". :type full_id: str, optional :param type: The equipment type. Defaults to "". :type type: str, optional :returns: Either the information to the equipment or None if no equipment matches the given identifier. In case the info's type is the search criteria the first encountered info with that type is returned. :rtype: EquipmentInfo | None .. py:method:: filtered_infos(by_type: str) -> list[EquipmentInfo] Filters the information by an equipment type. :param by_type: An equipment type like "trafo" :type by_type: str :returns: The filtered equipment informations, that have the given type. :rtype: list[EquipmentInfo] .. py:method:: contains(equip_type: str) -> bool Checks for the existence of a certain equipment. :param equip_type: The type of equipment (e.g. trafo, line, etc). :type equip_type: str :returns: Returns True, in case equipment with that type is found. :rtype: bool .. py:method:: get_eids(of_type: str) -> list[str] Returns the entity identifier of all equipment with a certain type. :param of_type: The equipment type. :type of_type: str :returns: A list containing the entity identifiers. If the grid does not contain any equipment of that type, then an empty list is returned. :rtype: list[str] .. py:method:: get_connected_ems(of_eid: str = '', of_info: EquipmentInfo = None) -> EquipmentInfo | None Searches for the connected ems and returns its informations. :param of_eid: The entity identifier of an existing . Defaults to "". :type of_eid: str, optional :param of_info: Information of the entity. Defaults to None. :type of_info: EquipmentInfo, optional :raises ValueError: If no argument is provided. :returns: None is returned, if no ems is connected. :rtype: EquipmentInfo | None .. py:method:: get_spec(e_id: str, spec: str) -> float | None Retrieves the value of the specification from the element with the e_id. :param e_id: An entitiy identifier of an existing component. :type e_id: str :param spec: The specification to retrieve. :type spec: str :returns: None is returned, in case no component with the given e_id is found or the component does not have that particular specification. :rtype: float | None .. py:method:: get_smart_ems_list() -> list[EquipmentInfo] Returns all smart EMS in a list. :returns: The list of smart EMS. :rtype: list[EquipmentInfo] .. py:method:: link(e_id_1: str, e_id_2: str) Adds the information about connection between the two equipments. In case there is no information about both equipments, nothing will be done. :param e_id_1: The entity identifier of the first equipment. :type e_id_1: str :param e_id_2: The entity identifier of the second equipment. :type e_id_2: str .. py:method:: is_equip(with_eid: str, of_type: str) -> bool Checks, if the equipment is of a certain type. :param with_eid: The entity identifier of the equipment. :type with_eid: str :param of_type: The type to match against (e.g. trafo, line,...). :type of_type: str :returns: Matches the equipment type against the provided type. :rtype: bool .. py:method:: get_equip_count(with_type: str) -> int Returns the number of equipment with the same type. :param with_type: The equipment type (e.g. trafo, line, etc) :type with_type: str :returns: The number of equipments of the same type in the grid. :rtype: int .. py:method:: connect_ems_and_devices(grid_model_config: dict, entities: dict) Connects the home energy management systems (ems) with their devices. :param grid_model_config: A dictionary containing the relation between the ems and the connected loads. :type grid_model_config: dict :param entities: A dictionary containing the all the entities grouped by their type. :type entities: dict .. py:method:: build_from(grid: mosaik.scenario.Entity, components_map: dict) -> GridInformation :staticmethod: Creates the grid information from the provided grid entity and the components_map. :param grid: The grid model instance, that is providing the entities of the components. :type grid: Entity :param components_map: The dictionary containing the information about the grid components. :type components_map: dict :returns: The informations about the grid components and their connection. :rtype: GridInformation .. py:class:: ComponentTypes(*args, **kwds) Bases: :py:obj:`enum.Enum` Summarizes the component types for less typos. .. py:method:: values() -> list[str] :staticmethod: Returns the value of each case. :returns: The values of each case. :rtype: list[str] .. py:method:: grid_comps() -> list[str] :staticmethod: Summarizes the component types. It excludes the ems as a component. :returns: The values of the component types. :rtype: list[str] .. py:function:: convert_to_list(entities_dict: dict[str, list]) -> list (Helper function) Returns all the entities combined in one list. :param entities_dict: The configuration dictionary used in the connect_entities_in_grid function. :type entities_dict: dict[str, list] :returns: The entities. :rtype: list .. py:function:: retrieve_type(entity: mosaik.scenario.Entity, entities_dict: dict[str, list]) -> str (Helper function) Returns a standardized type name. :param entity: The entity, whose type is determined. :type entity: Entity :param entities_dict: The configuration dictionary, that contains the grouped entities. :type entities_dict: dict[str, list] :returns: The type name e.g. heatpump, charging_station, etc. :rtype: str