netallocation.convert module

This module comprises functions to convert different representations of allocation into each other.

netallocation.convert.peer_to_peer(ds, n, aggregated=None, q=None)[source]

Convert a virtual injection pattern into a peer-to-peer allocation.

If a peer-to-peer array is already existent, nothing is done.

Parameters
  • ds (xarray.Dataset or xarray.DataArray) –

  • aggregated (boolean, defaut None) – Within the aggregated coupling scheme (obtained if set to True), power production and demand are ‘aggregated’ within the corresponding bus. Therefore only the net surplus or net deficit of a bus is allocated to other buses. Within the direct coupling scheme (if set to False), production and demand are considered independent of the bus, therefore the power production and demand are allocated to all buses at the same time. Defaults to ds.virtual_injection_pattern.attrs[‘aggregated’].

  • q (float, default None) – Only necessary when aggregated if False. Sets the shift parameter q, which determines the share of contribution of production and demand. Defaults to ds.virtual_injection_pattern.attrs[‘q’].

Returns

  • A xarray.Dataset with the peer-to-peer variable appended if a Dataset was

  • passed, passes the converted DataArray if a DataArray was passed.

netallocation.convert.vip_to_p2p(ds, n, direct=False)[source]
netallocation.convert.virtual_patterns(ds, n, q=0.5)[source]

Convert a peer-on-branch-to-peer into a virtual flow/injection pattern.

If a virtual flow pattern array is already existent, nothing is done.

Parameters
  • ds (xarray.Dataset or xarray.DataArray) –

  • n (pypsa.Network) – Underlying network. This is needed for determining the Incidence matrix.

  • q (float in [0,1]) – Ratio of net source and net sink contributions in the virtual patterns. If q=0 then only net importers are taken into account (if q=1 only net exporters).

Returns

  • A xarray.Dataset with the virtual flow pattern variable appended if a

  • Dataset was passed, passes the converted DataArray if a DataArray was passed.