pypsa.optimization.optimize.OptimizationAccessor.optimize_and_run_non_linear_powerflow#
- OptimizationAccessor.optimize_and_run_non_linear_powerflow(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', **kwargs: Any) dict #
Optimizes the network and then performs a non-linear power flow for all snapshots.
- Parameters:
n (pypsa.Network) – The PyPSA Network object to optimize and analyze.
snapshots (Sequence | None, optional) – Set of snapshots to consider in the optimization and power flow. If None, uses all snapshots in the network.
skip_pre (bool, optional) – Skip the preliminary steps of the power flow, by default False.
x_tol (float, optional) – Power flow convergence tolerance, by default 1e-06.
use_seed (bool, optional) – Use the last solution as initial guess, by default False.
distribute_slack (bool, optional) – Distribute slack power across generators, by default False.
slack_weights (str, optional) – How to distribute slack power, by default ‘p_set’.
**kwargs (Any) – Keyword arguments passed to the optimize function.
- Returns:
A tuple containing: - optimization status - optimization condition - dictionary of power flow results for all snapshots
- Return type: