Skip to content

NetworkDescriptorsMixin ΒΆ

Mixin class for network descriptor methods.

Class inherits to pypsa.Network. All attributes and methods can be used within any Network instance.

Methods:

pypsa.Network.get_extendable_i ΒΆ

get_extendable_i(c: str) -> Index

Getter function.

Get the index of extendable elements of a given component.

Deprecated: Use n.components[c].get_extendable_i() instead.

pypsa.Network.get_non_extendable_i ΒΆ

get_non_extendable_i(c: str) -> Index

Getter function.

Get the index of non-extendable elements of a given component.

Deprecated: Use n.components[c].self.fixed instead.

pypsa.Network.get_committable_i ΒΆ

get_committable_i(c: str) -> Index

Getter function.

Get the index of commitable elements of a given component.

Deprecated: Use n.components[c].get_committable_i() instead.

pypsa.Network.get_active_assets ΒΆ

get_active_assets(
    c: str,
    investment_period: int | str | Sequence | None = None,
) -> Series

Get active components mask of component type in investment period(s).

See the pypsa.components.descriptors.ComponentsDescriptorsMixin.get_active_assets.

Parameters:

  • c (string) –

    Component name

  • investment_period ((int, str, Sequence), default: None ) –

    Investment period(s) to check

Returns:

  • Series –

    Boolean mask for active components

pypsa.Network.get_switchable_as_dense ΒΆ

get_switchable_as_dense(
    component: str,
    attr: str,
    snapshots: Sequence | None = None,
    inds: Index | None = None,
) -> DataFrame

Return a Dataframe for a time-varying component attribute .

Values for all non-time-varying components are filled in with the default values for the attribute.

Parameters:

  • component (string) –

    Component object name, e.g. 'Generator' or 'Link'

  • attr (string) –

    Attribute name

  • snapshots (Index, default: None ) –

    Restrict to these snapshots rather than n.snapshots.

  • inds (Index, default: None ) –

    Restrict to these components rather than n.components.index

Returns:

  • DataFrame –

Examples:

>>> n.get_switchable_as_dense('Generator', 'p_max_pu', n.snapshots[:2])
Generator            Manchester Wind  Manchester Gas  Norway Wind  Norway Gas  Frankfurt Wind  Frankfurt Gas
snapshot
2015-01-01 00:00:00         0.930020             1.0     0.974583         1.0        0.559078            1.0
2015-01-01 01:00:00         0.485748             1.0     0.481290         1.0        0.752910            1.0

pypsa.Network.get_switchable_as_iter ΒΆ

get_switchable_as_iter(
    component: str,
    attr: str,
    snapshots: Sequence,
    inds: Index | None = None,
) -> DataFrame

Return an iterator over snapshots for a time-varying component attribute.

Values for all non-time-varying components are filled in with the default values for the attribute.

Parameters:

  • component (string) –

    Component object name, e.g. 'Generator' or 'Link'

  • attr (string) –

    Attribute name

  • snapshots (Index) –

    Restrict to these snapshots rather than n.snapshots.

  • inds (Index, default: None ) –

    Restrict to these items rather than all of n.{generators, ..}.index

Returns:

  • DataFrame –

Examples:

>>> gen = n.get_switchable_as_iter('Generator', 'p_max_pu', n.snapshots[:2])
>>> next(gen)
name
Manchester Wind    0.930020
Manchester Gas     1.000000
Norway Wind        0.974583
Norway Gas         1.000000
Frankfurt Wind     0.559078
Frankfurt Gas      1.000000
dtype: float64

pypsa.Network.bus_carrier_unit ΒΆ

bus_carrier_unit(
    bus_carrier: str | Sequence[str] | None,
) -> str

Determine the unit associated with a specific bus carrier in the network.

Parameters:

  • bus_carrier (str | Sequence[str] | None) –

    The carrier type of the bus to query.

Returns:

  • str ( str ) –

    The unit associated with the specified bus carrier. If no bus carrier is provided, returns "carrier dependent".

Raises:

  • ValueError –

    If the specified bus carrier is not found in the network or if multiple units are found for the specified bus carrier.