NetworkDescriptorsMixin
¶
flowchart TD
pypsa.Network[NetworkDescriptorsMixin]
pypsa.network.abstract._NetworkABC[_NetworkABC]
pypsa.network.abstract._NetworkABC --> pypsa.Network
click pypsa.Network href "" "pypsa.Network"
click pypsa.network.abstract._NetworkABC href "" "pypsa.network.abstract._NetworkABC"
Mixin class for network descriptor methods.
Class inherits to pypsa.Network. All attributes and methods can be used within any Network instance.
-
API Reference
Networks
Network
Network
Methods:
-
get_extendable_i–Getter function.
-
get_non_extendable_i–Getter function.
-
get_committable_i–Getter function.
-
get_active_assets–Get active components mask of component type in investment period(s).
-
get_switchable_as_dense–Return a Dataframe for a time-varying component attribute .
-
get_switchable_as_iter–Return an iterator over snapshots for a time-varying component attribute.
-
bus_carrier_unit–Determine the unit associated with a specific bus carrier in the network.
pypsa.Network.get_extendable_i
¶
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
¶
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
¶
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 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 component names rather than all components. For stochastic networks, the names are selected in all scenarios. The columns follow component order, duplicates are collapsed and unknown names dropped. In PyPSA 2.0, columns follow
indsorder, duplicates are kept and unknown names raise aKeyError.
Returns:
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) -> Iterator[Series]
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 component names rather than all components. For stochastic networks, the names are selected in all scenarios. The result follows the order of
inds. Duplicates and unknown names are dropped.
Returns:
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
¶
Determine the unit associated with a specific bus carrier in the network.
Parameters:
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.