Networks#
Network#
Constructor#
- class pypsa.Network(import_name: str | Path = '', name: str = '', ignore_standard_types: bool = False, override_components: DataFrame | None = None, override_component_attrs: Dict | None = None, **kwargs: Any)#
Network container for all buses, one-ports and branches.
- Parameters:
import_name (string, Path) – Path to netCDF file, HDF5 .h5 store or folder of CSV files from which to import network data. The string could be a URL. If cloudpathlib is installed, the string could be a object storage URI with an s3, gs or az URI scheme.
name (string, default "") – Network name.
ignore_standard_types (boolean, default False) – If True, do not read in PyPSA standard types into standard types DataFrames.
override_components (pandas.DataFrame) – If you want to override the standard PyPSA components in pypsa.components.components, pass it a DataFrame with index of component name and columns of list_name and description, following the format of pypsa.components.components. See git repository examples/new_components/.
override_component_attrs (pypsa.descriptors.Dict of pandas.DataFrame) – If you want to override pypsa.component_attrs, follow its format. See Components for more information.
kwargs – Any remaining attributes to set
- Return type:
None
Examples
>>> nw1 = pypsa.Network("my_store.h5") >>> nw2 = pypsa.Network("/my/folder") >>> nw3 = pypsa.Network("https://github.com/PyPSA/PyPSA/raw/master/examples/scigrid-de/scigrid-with-load-gen-trafos.nc") >>> nw4 = pypsa.Network("s3://my-bucket/my-network.nc")
General methods#
|
Return the DataFrame of static components for component_name, i.e. n.component_names. |
|
Alias for |
|
Return the dictionary of DataFrames of varying components for component_name, i.e. n.component_names_t. |
|
Alias for |
|
Convert the network's geometries and bus coordinates to a new coordinate reference system. |
|
Set the snapshots/time steps and reindex all time-dependent data. |
|
Set the investment periods of the network. |
|
Add components to the network. |
|
Add multiple components to the network, along with their attributes. |
|
Removes a single component or a list of components from the network. |
|
Removes multiple components from the network. |
|
Returns a deep copy of Network objec t. |
|
|
|
Build sub_networks from topology. |
|
|
|
Checks the network for consistency; e.g. that all components are connected to existing buses and that no impedances are singular. |
Attributes#
Dictionary of the network meta data. |
|
Coordinate reference system of the network's geometries (n.shapes). |
|
Spatial reference system identifier of the network's geometries (n.shapes). |
|
Time steps of the network |
|
Weightings applied to each snapshots during the optimization (LOPF). |
|
Investment steps during the optimization. |
|
Weightings applied to each investment period during the optimization (LOPF). |
Input and output methods#
|
Merge the components of two networks. |
|
Import network data from CSVs in a folder. |
|
Export network and components to a folder of CSVs. |
|
Import network data from HDF5 store at path. |
|
Export network and components to an HDF store. |
|
Import network data from netCDF file or xarray Dataset at path. |
|
Export network and components to a netCDF file. |
|
Import network from PYPOWER PPC dictionary format version 2. |
|
Import PyPSA network from pandapower net. |
|
Import components from a pandas DataFrame. |
|
Import time series from a pandas DataFrame. |
Power flow methods#
Also see Power Flow for all power flow functions.
Contingency analysis#
See Contingency Analysis.
Clustering methods#
See Clustering.
Optimization methods#
See Optimisation.
Statistics methods#
See Statistics.
Plotting methods#
See Plots.
Graph methods#
|
Build NetworkX graph. |
|
Construct a sparse adjacency matrix (directed) |
|
Construct a sparse incidence matrix (directed) |
Descriptor methods#
Getter function. |
|
Getter function. |
|
|
Return a Dataframe for a time-varying component attribute with values for all non-time-varying components filled in with the default values for the attribute. |
Getter function. |
|
|
Get active components mask of component type in investment period(s). |
Sub-Network#
Constructor#
methods#
|
Construct a sparse adjacency matrix (directed) |
|
|
|
|
|
|
|
|
|
Calculate the Branch Outage Distribution Factor (BODF) for sub_network. |
|
Calculate B and H matrices for AC or DC sub-networks. |
|
Calculate the Power Transfer Distribution Factor (PTDF) for sub_network. |
|
Calculate bus admittance matrices for AC sub-networks. |
Find slack and all PV and PQ buses for a sub_network. |
|
Find the slack bus in a connected sub-network. |
|
|
Build NetworkX graph. |
|
Construct a sparse incidence matrix (directed) |
|
Iterate over components of the sub-network and extract corresponding data. |
|
|
|
|
|
|
|
Linear power flow for connected sub-network. |
|
Non-linear power flow for connected sub-network. |
|
|