Labeling Concept

Tessif persues a quite unique approach when it comes to naming or labeling its Energy System Components. Following sections provide details on how component labeling is implemented in tessif and how it’s features allow both, simple and comprehensive identification as well as aggregation of auxilliary information.

Bases

Each component that is part of an energy system modeled with the help of tessif must be uniquely identifiable. This is archieved by using unique identifiers (uids).

Apart from a name attribute which is mandatory, a uid incorporates several other optional parameters storing for example geographical infromation like latitude or longitude as well as simulative meta data like node_type.

Following statement serves as baseline for a component to qualify as unique:

Warning

For a component to be unique the overall combination of it’s internally used parameters must be unique.

Internal Representation

Each of tessif's energy system component has a uid with a complete set of parameters. This however does not mean every single one of those parameters is used internally for identification. In fact by default, only the name is used.

The configuration parameters node_uid_style and node_uid_seperator determine which parts of the uid are used for internal representation. And can be modified as in the example shown below

Example

  1. Import the configurations module for modifying its attributes:

    >>> import tessif.frused.configurations as configurations
    
  2. Import and create a minimum working example using tessif's example hub:

    >>> from tessif.examples.data.tsf.py_hard import create_mwe
    >>> examplary_energy_system = create_mwe()
    
  3. Check the current label settings:

    >>> print(configurations.node_uid_style)
    name
    >>> print(configurations.node_uid_seperator)
    _
    
  4. Print the busses’ uids:

    >>> for bus in examplary_energy_system.busses:
    ...     print(bus.uid)
    Pipeline
    Powerline
    
  5. Check the available settings for modifying the node_uid_style:

    >>> from tessif.frused.namedtuples import node_uid_styles
    >>> for option in node_uid_styles:
    ...     print(option)
    name
    qualname
    coords
    region
    sector
    carrier
    component
    node_type
    
  6. Modify the label settings to use geospatial coordinates for the internal representation as well:

    >>> configurations.node_uid_style = 'coords'
    
  7. Print the busses’ uids again:

    >>> for bus in examplary_energy_system.busses:
    ...     print(bus.uid)
    Pipeline_0.0_0.0
    Powerline_0.0_0.0
    
  8. Modify the seperator to modify the displayed representation:

    >>> configurations.node_uid_seperator = '_(^0_0^)_'
    
  9. Print the busses’ uids again:

    >>> for bus in examplary_energy_system.busses:
    ...     print(bus.uid)
    Pipeline_(^0_0^)_0.0_(^0_0^)_0.0
    Powerline_(^0_0^)_0.0_(^0_0^)_0.0
    
  10. Reset everything back to default:

    >>> configurations.node_uid_style = 'name'
    >>> configurations.node_uid_seperator = '_'
    

Expansion

To expand tessif's labeling concept following 3 stept are recommonded:

  1. Add your parameter to the class body of tessif.frused.namedtuples.UidBase as in:

    my_parameter: str
    
  2. Add your parameter to the __new__ and super() call of tessif.frused.namedtuples.Uid as in:

    • __new__:

      def __new__(cls, ..., my_parameter=default_value)
      
    • super():

      self = super(cls,..., my_parameter)
      
  3. Modify tessif.frused.namedtuples.node_uid_styles to respect the new parameter as for example in:

    node_uid_styles = {
        'name': ['name'],
        'qualname': [i for i in Uid.__new__.__code__.co_varnames
            if i not in ['self', 'cls']],
         ...
        'my_parameter: ['name', 'my_parameter'],}
    

Valuation

Realising a dynamic labeling concept involves several advantages and disadvantages of which the most predominant are discussed in the following section. The comparisons drawn are to be interpreted as relative to a static labeling concept in which it’s up to the user to enforce unique hashable ids for each of the components.

Disadvantages

  • Using a NamedTuple instead of a plain string can involve overhead in computational ressources and memory used

  • It is more complex for beginners to understand

  • Potentially not all of the supported models will be able to use such an approach

Advantages

  • Utilized label information can adapt to the complexity and size of the simulative task

  • Relatively simple expansion / modification

  • Individual information can be attached to the components without influencing the energy system or the solver