NetworkPowerFlowMixin
ΒΆ
flowchart TD
pypsa.Network[NetworkPowerFlowMixin]
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 power flow methods.
Class inherits to pypsa.Network. All attributes and methods can be used within any Network instance.
Methods:
-
calculate_dependent_valuesβCalculate per unit impedances and append voltages to lines and shunt impedances.
-
lpfβLinear power flow for generic network.
-
lpf_contingencyβCompute linear power flow for a selection of branch outages.
-
pfβFull non-linear power flow for generic network.
pypsa.Network.calculate_dependent_values
ΒΆ
calculate_dependent_values() -> None
Calculate per unit impedances and append voltages to lines and shunt impedances.
pypsa.Network.lpf
ΒΆ
lpf(n: Network, snapshots: Sequence | None = None, skip_pre: bool = False) -> None
Linear power flow for generic network.
Parameters:
-
n(Network) βThe network to run the power flow on.
-
snapshots(list-like|single snapshot, default:None) βA subset or an elements of n.snapshots on which to run the power flow, defaults to n.snapshots
-
skip_pre(bool, default:False) βSkip the preliminary steps of computing topology, calculating dependent values and finding bus controls.
pypsa.Network.lpf_contingency
ΒΆ
lpf_contingency(snapshots: Sequence | str | int | Timestamp | None = None, branch_outages: Sequence | None = None) -> DataFrame
Compute linear power flow for a selection of branch outages.
Parameters:
-
snapshots(list-like|single snapshot, default:None) βA subset or an elements of n.snapshots on which to run the power flow, defaults to n.snapshots NB: currently this only works for a single snapshot
-
branch_outages(list - like, default:None) βA list of passive branches which are to be tested for outages. If None, it's take as all n.passive_branches_i()
Returns:
-
p0(DataFrame) βnum_passive_branch x num_branch_outages DataFrame of new power flows
pypsa.Network.pf
ΒΆ
pf(n: Network, snapshots: Sequence | None = None, skip_pre: bool = False, x_tol: float = 1e-06, use_seed: bool = False, distribute_slack: bool = False, slack_weights: str = 'p_set') -> Dict
Full non-linear power flow for generic network.
Parameters:
-
n(Network) βThe network to run the power flow on.
-
snapshots(list-like|single snapshot, default:None) βA subset or an elements of n.snapshots on which to run the power flow, defaults to n.snapshots
-
skip_pre(bool, default:False) βSkip the preliminary steps of computing topology, calculating dependent values and finding bus controls.
-
x_tol(float, default:1e-06) βTolerance for Newton-Raphson power flow.
-
use_seed(bool, default:False) βUse a seed for the initial guess for the Newton-Raphson algorithm.
-
distribute_slack(bool, default:False) βIf
True, distribute the slack power across generators proportional to generator dispatch by default or according to the distribution scheme provided inslack_weights. Ifalseonly the slack generator takes up the slack. -
slack_weights(dict | str, default:'p_set') βDistribution scheme describing how to determine the fraction of the total slack power (of each sub network individually) a bus of the sub-network takes up. Default is to distribute proportional to generator dispatch ('p_set'). Another option is to distribute proportional to (optimised) nominal capacity ('p_nom' or 'p_nom_opt'). Custom weights can be specified via a dictionary that has a key for each sub-network index (
n.sub_networks.index) and a pandas.Series/dict with buses or generators of the corresponding sub-network as index/keys. When specifying custom weights with buses as index/keys the slack power of a bus is distributed among its generators in proportion to their nominal capacity (p_nom) if given, otherwise evenly.
Returns:
-
dictβDictionary with keys 'n_iter', 'converged', 'error' and dataframe values indicating number of iterations, convergence status, and iteration error for each snapshot (rows) and sub_network (columns)