Skip to content

Network

Like PyPSA, TyPSA provides a Network object.

API Reference

Network

buses property

buses: dict[str, Bus[T]]

Get all Bus instances.

carriers property

carriers: dict[str, Carrier]

Get all Carrier instances.

generators property

generators: dict[str, Generator[T] | ExtendableGenerator[T] | CommittableGenerator[T]]

Get all Generator, ExtendableGenerator, and CommittableGenerator instances.

global_constraints property

global_constraints: dict[str, GlobalConstraint]

Get all GlobalConstraint instances.

lines property

lines: dict[str, Line[T] | ExtendableLine[T]]

Get all Line and ExtendableLine instances.

links: dict[str, Link[T] | ExtendableLink[T] | CommittableLink[T]]

Get all Link, ExtendableLink, and CommittableLink instances.

loads property

loads: dict[str, Load]

Get all Load instances.

shunt_impedances property

shunt_impedances: dict[str, ShuntImpedance]

Get all ShuntImpedance instances.

storage_units property

storage_units: dict[str, StorageUnit[T] | ExtendableStorageUnit[T]]

Get all StorageUnit and ExtendableStorageUnit instances.

stores property

stores: dict[str, Store[T] | ExtendableStore[T]]

Get all Store and ExtendableStore instances.

transformers property

transformers: dict[str, Transformer[T] | ExtendableTransformer[T]]

Get all Transformer and ExtendableTransformer instances.

plot property

plot: PlotAccessor

Access plotting functionality.

__init__

__init__(snapshots: T = Static()) -> None

Create a typsa.Network with the given snapshots.

from_pypsa_network classmethod

from_pypsa_network(pypsa_network: Network, snapshots_class: type[T2]) -> Network[T2]

Create a typsa.Network from a pypsa.Network.

add_components

add_components(*components: BaseComponent[T]) -> None

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, 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, PowerFlowInfo]

Run nonlinear power flow on the optimized network.

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 are per-horizon and thus not returned. However, solver status and objective value are logged per-horizon.

Returns:

Type Description
OptimizedNetwork[T]

Optimized network.

OptimizedNetwork

static_results property

static_results: OptimizationStaticResults

Access static optimization results.

dynamic_results property

dynamic_results: OptimizationDynamicResults

Access dynamic optimization results.

buses property

buses: dict[str, Bus[T]]

Get all Bus instances.

carriers property

carriers: dict[str, Carrier]

Get all Carrier instances.

generators property

generators: dict[str, Generator[T] | ExtendableGenerator[T] | CommittableGenerator[T]]

Get all Generator, ExtendableGenerator, and CommittableGenerator instances.

global_constraints property

global_constraints: dict[str, GlobalConstraint]

Get all GlobalConstraint instances.

lines property

lines: dict[str, Line[T] | ExtendableLine[T]]

Get all Line and ExtendableLine instances.

links: dict[str, Link[T] | ExtendableLink[T] | CommittableLink[T]]

Get all Link, ExtendableLink, and CommittableLink instances.

loads property

loads: dict[str, Load]

Get all Load instances.

shunt_impedances property

shunt_impedances: dict[str, ShuntImpedance]

Get all ShuntImpedance instances.

storage_units property

storage_units: dict[str, StorageUnit[T] | ExtendableStorageUnit[T]]

Get all StorageUnit and ExtendableStorageUnit instances.

stores property

stores: dict[str, Store[T] | ExtendableStore[T]]

Get all Store and ExtendableStore instances.

transformers property

transformers: dict[str, Transformer[T] | ExtendableTransformer[T]]

Get all Transformer and ExtendableTransformer instances.

plot property

plot: PlotAccessor

Access plotting functionality.

lpf

lpf(snapshots: T | None = None, skip_pre: bool = False) -> tuple[LinearPowerFlowDynamicResults, 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, PowerFlowInfo]

Run nonlinear power flow on the optimized network.