Skip to content

Line

Use the Line class to represent a transmission or distribution line with a given apparent power capacity (s_nom).

Set parameters=CustomLineParameters(...) to represent a line with given values for series reactance (x), series resistance (r), shunt conductivity (g) and shunt susceptance (b).

Set parameters=StandardLineParameters(...) to represent a line with a standard line type, for which the x, r, g, and b values will be calculated automatically based on the line's length and number of parallel conductors (num_parallel).

Use the ExtendableLine class to represent a hypothetical line with an apparent power capacity that is flexible, in order to optimize its apparent power capacity (ExtendableLineOptimizationStaticResults.s_nom_opt).

API Reference

Line and ExtendableLine both inherit from the BaseLine parent class.

CustomLineParameters

Bases: BaseModel

x: float = Field(default=0.0, ge=0.0)

Series reactance, must be non-zero for AC branch for linearised power flow equations. If the line has series inductance \(L\) in Henries then \(x = 2\pi f L\) where \(f\) is the frequency in Hertz. Series impedance \(z = r + jx\) must be non-zero for non-linear power flow calculations.

r: float = Field(default=0.0, ge=0.0)

Series resistance, must be non-zero for DC branch for linearised power flow equations. Series impedance \(z = r + jx\) must be non-zero for the non-linear power flow.

g: float = Field(default=0.0, ge=0.0)

Shunt conductivity. Shunt admittance is \(y = g + jb\).

b: float = Field(default=0.0, ge=0.0)

Shunt susceptance. If the line has shunt capacitance \(C\) in Farads then \(b = 2\pi f C\) where \(f\) is the frequency in Hertz. Shunt admittance is \(y = g + jb\).

StandardLineParameters

Bases: BaseModel

type: StandardLineType

Name of line standard type. The line standard type impedance parameters are multiplied with the length and divided/multiplied by num_parallel to compute x, r, etc.

length: float = Field(default=0.0, ge=0.0)

Length of line. Also useful for calculating capital_cost.

num_parallel: float = Field(default=1.0, ge=1.0)

Number of parallel circuits. Can also be fractional.

BaseLine

Bases: SNomExtendableComponent[T]

Lines include distribution and transmission lines, overhead lines and cables.

PyPSA user guide for this component.

bus0: str = Field(min_length=1)

Name of origin bus to which branch is attached.

bus1: str = Field(min_length=1)

Name of destination bus to which branch is attached.

parameters: CustomLineParameters | StandardLineParameters

Line parameters.

s_nom_extendable: bool

Switch to allow capacity s_nom to be extended in optimisation.

s_max_pu: float | Series[T] = Field(default=1.0, ge=0.0, le=1.0)

The maximum allowed absolute apparent power flow per unit of s_nom for the optimisation (e.g. can set s_max_pu<1 to approximate \(N-1\) contingency factor, or can be time-varying to represent weather-dependent dynamic line rating for overhead lines).

capital_cost: float = Field(default=0.0, ge=0.0)

Fixed period costs of extending s_nom by 1 MVA, including periodized investment costs and periodic fixed O&M costs (e.g. annuitized investment costs). Any length factor must already be included here.

active: bool = True

Whether to consider the component in optimisation or not.

build_year: int | None = None

Build year of line.

lifetime: float | None = Field(default=None, gt=0.0)

Lifetime of line.

carrier: str | None = Field(default=None, min_length=1)

Type of current. "AC" is the only valid value for lines.

terrain_factor: float = Field(default=1.0, ge=1.0)

Terrain factor for increasing length for capital_cost calculation.

Line

Bases: BaseLine[T]

s_nom: float = Field(default=0.0, ge=0.0)

Limit of apparent power which can pass through branch in either direction.

ExtendableLine

Bases: BaseLine[T]

s_nom_mod: float = Field(default=0.0, ge=0.0)

Modular unit size of line expansion of s_nom (e.g. fixed rating of added circuit). Introduces integer variables.

s_nom_min: float = Field(default=0.0, ge=0.0)

Minimum value of s_nom_opt.

s_nom_max: float | None = Field(default=None, gt=0.0)

Maximum value of s_nom_opt.

s_nom_set: float | None = Field(default=None, ge=0.0)

Set value of s_nom_opt.

LineOptimizationStaticResults

Bases: BaseStaticResults

x_pu: float = 0.0

Per unit series reactance calculated by n.calculate_dependent_values() from x and n.buses.v_nom.

r_pu: float = 0.0

Per unit series resistance calculated by n.calculate_dependent_values() from r and n.buses.v_nom.

g_pu: float = 0.0

Per unit shunt conductivity calculated by n.calculate_dependent_values() from g and n.buses.v_nom.

b_pu: float = 0.0

Per unit shunt susceptance calculated by n.calculate_dependent_values() from b and n.buses.v_nom.

x_pu_eff: float = 0.0

Effective per unit series reactance for linear power flow, calculated by n.calculate_dependent_values() from x and n.buses.v_nom.

r_pu_eff: float = 0.0

Effective per unit series resistance for linear power flow, calculated by n.calculate_dependent_values() from r and n.buses.v_nom.

LineBaseDynamicResults

Bases: BaseDynamicResults

p0: pandas.DataFrame

Active power at bus0 (positive if branch is withdrawing power from bus0).

p1: pandas.DataFrame

Active power at bus1 (positive if branch is withdrawing power from bus1).

LineOptimizationDynamicResults

Bases: LineBaseDynamicResults

mu_lower: pandas.DataFrame

Shadow price of lower s_nom limit \(-F \leq f\). Always non-negative.

mu_upper: pandas.DataFrame

Shadow price of upper s_nom limit \(f \leq F\). Always non-negative.

LinePfDynamicResults

LineNonlinearPfDynamicResults

Bases: LinePfDynamicResults

q0: pandas.DataFrame

Reactive power at bus0 (positive if branch is withdrawing power from bus0).

q1: pandas.DataFrame

Reactive power at bus1 (positive if branch is withdrawing power from bus1).