Network
Like PyPSA, TyPSA provides a Network object.
API Reference
Network
from_pypsa_network
classmethod
Create a typsa.Network from a pypsa.Network.
add_components
Add one or more components to the network.
determine_network_topology
determine_network_topology(investment_period: int | str | None = None, skip_isolated_buses: bool = False) -> TopologyDeterminedNetwork[T]
Build SubNetworks from topology.
lpf
lpf(snapshots: T | None = None, skip_pre: bool = False) -> tuple[LinearPowerFlowDynamicResults[T], PowerFlowInfo]
Run linearized power flow on the optimized network.
pf
pf(snapshots: T | None = None, skip_pre: bool = False, x_tol: float = 1e-06, use_seed: bool = False, distribute_slack: bool = False, slack_weights: str = 'p_set') -> tuple[NonlinearPowerFlowDynamicResults[T], PowerFlowInfo]
Run nonlinear power flow on the optimized network.
lpf_contingency
lpf_contingency(snapshots: T, branch_outages: Sequence[BaseLine[T] | BaseTransformer[T]] | None = None) -> LinearPowerFlowContingencyResults
Run linear power flow on the optimized network for each of the specified branch outages in addition to the no-outage "base" case.
optimize
optimize(snapshots: T | None = None, multi_investment_periods: bool = False, transmission_losses: int = 0, linearized_unit_commitment: bool = False, extra_functionality: Callable[[Network, Index], None] | None = None, assign_all_duals: bool = False, solver_name: str | None = None, solver_options: dict[str, Any] | None = None, compute_infeasibilities: bool = False, **kwargs: Any) -> tuple[OptimizedNetwork[T], OptimizationInfo]
Optimize the network (model and solve its optimization problem).
Returns:
| Type | Description |
|---|---|
tuple[OptimizedNetwork[T], OptimizationInfo]
|
Optimized network and optimization info. |
optimize_with_rolling_horizon
optimize_with_rolling_horizon(horizon: int, overlap: int = 0, snapshots: T | None = None, multi_investment_periods: bool = False, transmission_losses: int = 0, linearized_unit_commitment: bool = False, extra_functionality: Callable[[Network, Index], None] | None = None, assign_all_duals: bool = False, solver_name: str | None = None, solver_options: dict[str, Any] | None = None, compute_infeasibilities: bool = False, **kwargs: Any) -> OptimizedNetwork[T]
Optimize the network in a rolling horizon fashion.
Optimization info is per-horizon and thus not returned. However, solver status and objective value are logged per-horizon.
Returns:
| Type | Description |
|---|---|
OptimizedNetwork[T]
|
Optimized network. |
optimize_security_constrained
optimize_security_constrained(snapshots: T | None = None, branch_outages: Sequence[BaseLine[T] | BaseTransformer[T]] | None = None, multi_investment_periods: bool = False, transmission_losses: int = 0, linearized_unit_commitment: bool = False, extra_functionality: Callable[[Network, Index], None] | None = None, assign_all_duals: bool = False, solver_name: str | None = None, solver_options: dict[str, Any] | None = None, compute_infeasibilities: bool = False, **kwargs: Any) -> tuple[OptimizedNetwork[T], OptimizationInfo]
Compute Security-Constrained Linear Optimal Power Flow (SCLOPF).
Returns:
| Type | Description |
|---|---|
tuple[OptimizedNetwork[T], OptimizationInfo]
|
Optimized network and optimization info. |
OptimizedNetwork
all_capacities
property
Access capacities for components, whether extendable or non-extendable components.
static_results
property
Access static optimization results.
dynamic_results
property
Access dynamic optimization results.
lpf
lpf(snapshots: T | None = None, skip_pre: bool = False) -> tuple[LinearPowerFlowDynamicResults[T], PowerFlowInfo]
Run linearized power flow on the optimized network.