eelib.core.control.grid.grid_ems_simulator

Mosaik interface for the eELib grid energy management system model. Simulator for communication between orchestrator (mosaik) and grid EMS entities.

Within this interface mosaik functionalities are used. Copyright (c) LGPL

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

Sim

Simulator class for eELib grid EMS model.

Attributes

META

ADAPTION_TOLERANCE

META
ADAPTION_TOLERANCE = '1e-05'
class Sim

Bases: mosaik_api_v3.Simulator

Simulator class for eELib grid EMS model.

output_cache
entities
init(sid: str, scenario_config: dict, time_resolution: int = 1) dict

Initializes parameters for an object of the grid_ems:Sim class.

Parameters:
  • sid (str) – ID of the created entity of the simulator (e.g. GridEMSSim-0)

  • scenario_config (dict) – scenario configuration data, like resolution or step size

  • time_resolution (int) – fitting of the step size to the simulation scenario step size.

Returns:

description of the simulator

Return type:

dict

create(num: int, model_type: str, init_vals: dict = None) dict

Creates entities of the eELib grid EMS model. Core function of mosaik.

Parameters:
  • num (int) – number of models to be created

  • model_type (str) – type of created entity (e.g. “grid_ems”)

  • init_vals (dict) – Dict with initial values for each grid EMS entity, defaults to None

Raises:

ValueError – If entity ID is already existing

Returns:

created entities

Return type:

dict

get_entity_by_id(entity_id: str) eelib.core.control.grid.grid_ems_model.GridEMS

Searches for a requested entity id and gives back the entity model.

Parameters:

entity_id (str) – id of the entity to be searched for

Returns:

entity model if found, None otherwise

Return type:

grid_ems_model.GridEMS

step(time: int, inputs: dict, max_advance: int) int

Performs simulation step calling the eELib grid EMS model. Core function of mosaik.

Parameters:
  • time (int) – current simulation time (given by mosaik)

  • inputs (dict) – allocation of set values to specific models

  • max_advance (int) – simulation time until the simulator can safely advance it’s internal time without causing any causality errors.

Returns:

next timestep (when orchestrator calls again)

Return type:

int

get_data(outputs: dict) dict

Gets the data for the next concatenated model. Core function of mosaik.

Parameters:

outputs (dict) – dictionary with data outputs from each control model

Raises:

ValueError – error if attribute not in model metadata

Returns:

dictionary with simulation outputs

Return type:

dict

add_controlled_entity(control_entity_eid: str, entity_dict: dict)

Adds entities (e.g. pv systems) to the specific control unit entity.

Parameters:
  • control_entity_eid (str) – entity id of control unit entity

  • entity_dict (dict) – Dictionary of created models to be added to the control unit entity

add_info_to_entity(with_id: str, info: eelib.data.dataclass.GridInformation)

Adds the grid information to the grid operator.

Parameters:
  • with_id (str) – The entity id of the control unit.

  • info (GridInformation) – The summary of the important equipment informations.

get_model(with_id: str) eelib.core.control.grid.grid_ems_model.GridEMS

Helper method for testing only! Queries the underlying model object.

Parameters:

with_id (str) – The entity identifier of the model object.

Returns:

The GridEMS object with the id.

Return type:

grid_ems_model.GridEMS