deflex.get_combined_bus_balance

deflex.get_combined_bus_balance(results, cat=None, tag=None, subtag=None, region=None)[source]

Combine different buses of the same type.

The combined buses can be restricted by the label fields (cat, tag, subtag, region). Only buses with the same label fields will be combined.

Parameters:
  • results (dict) – Deflex results dictionary.
  • cat (str) – Category of the buses.
  • tag (str) – Tag of the buses.
  • subtag (str) – Subtag of the buses.
  • region (str) – Region of the buses
Returns:

Return type:

pandas.DataFrame

Examples

>>> import deflex as dflx
>>> fn = dflx.fetch_test_files("de03_fictive.dflx")
>>> my_results = dflx.restore_results(fn)
>>> get_combined_bus_balance(my_results, cat="electricity")["out"].columns
MultiIndex([('decentralised heat',    'heat pump',   'heat pump', 'DE02'),
            ('electricity demand',  'electricity',         'all', 'DE01'),
            ('electricity demand',  'electricity',         'all', 'DE02'),
            (            'excess',  'electricity',         'all', 'DE01'),
            (            'excess',  'electricity',         'all', 'DE02'),
            (            'excess',  'electricity',         'all', 'DE03'),
            (    'fuel converter',  'electricity', 'electricity', 'DE01'),
            (    'fuel converter',  'electricity', 'electricity', 'DE02'),
            (              'line',  'electricity',        'DE01', 'DE02'),
            (              'line',  'electricity',        'DE01', 'DE03'),
            (              'line',  'electricity',        'DE02', 'DE01'),
            (              'line',  'electricity',        'DE02', 'DE03'),
            (              'line',  'electricity',        'DE03', 'DE01'),
            (              'line',  'electricity',        'DE03', 'DE02'),
            (   'other converter', 'Electrolysis', 'electricity',   'DE'),
            (           'storage',  'electricity',     'battery', 'DE01'),
            (           'storage',  'electricity',        'phes', 'DE01')],
           )
>>> get_combined_bus_balance(
...     my_results, cat="electricity", region="DE03")["out"].columns
MultiIndex([('excess', 'electricity',  'all', 'DE03'),
            (  'line', 'electricity', 'DE03', 'DE01'),
            (  'line', 'electricity', 'DE03', 'DE02')],
           )