Skip to content

Transformer

Use the Transformer class to represent a transformer with a given apparent power capacity (s_nom).

Set parameters=CustomTransformerParameters(...) to represent a transformer with given values for series reactance (x), series resistance (r), shunt conductivity (g), shunt susceptance (b), tap_ratio, tap_side, and phase_shift.

Set parameters=StandardTransformerParameters(...) to represent a transformer with a standard transformer type, for which the x, r, etc. values will be calculated automatically based on the number of parallel transformers (num_parallel).

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

API Reference

Transformer and ExtendableTransformer both inherit from the BaseTransformer parent class.

CustomTransformerParameters

Bases: BaseModel

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

Series reactance (per unit, using s_nom as base power); must be non-zero for AC branch in linear power flow. Series impedance \(z = r + jx\) must be non-zero for the non-linear power flow.

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

Series resistance (per unit, using s_nom as base power); must be non-zero for DC branch in linear power flow. 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 (per unit, using s_nom as base power).

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

Shunt susceptance (per unit, using s_nom as base power).

tap_ratio: float = Field(default=1.0, gt=0.0)

Ratio of per unit voltages at each bus for tap changed.

tap_side: Literal[0, 1] = 0

Defines if tap changer is modelled at the primary 0 side (usually high-voltage) or the secondary 1 side (usually low voltage) (must be 0 or 1, defaults to 0).

phase_shift: float = Field(default=0.0, ge=0.0, lt=360.0)

Voltage phase angle shift.

StandardTransformerParameters

Bases: BaseModel

type: StandardTransformerType | None = None

Name of 2-winding transformer standard type. The transformer type impedance parameters are taken from the standard type along with num_parallel.

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

Number of parallel transformers (can also be fractional).

tap_position: int = 0

Determines position relative to the neutral tap position.

BaseTransformer

Bases: SNomExtendableComponent[T]

2-winding transformer.

PyPSA user guide for this component.

bus0: str = Field(min_length=1)

Name of origin bus (typically higher voltage) to which transformer is attached.

bus1: str = Field(min_length=1)

Name of destination bus (typically lower voltage) to which transformer is attached.

parameters: CustomTransformerParameters | StandardTransformerParameters

Transformer parameters.

model: Literal['t', 'pi'] = 't'

Model used for admittance matrix; can be "t" or "pi"; defaults to "t" following physics and DIgSILENT PowerFactory.

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 flow per unit of s_nom for the optimisation.

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

Fixed period costs of extending p_nom by 1 MVA, including periodized investment costs and periodic fixed O&M costs (e.g. annuitized investment costs).

active: bool = True

Whether to consider the component in optimisation or not.

build_year: int | None = None

Build year of transformer.

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

Lifetime of transformer.

Transformer

Bases: BaseTransformer[T]

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

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

ExtendableTransformer

Bases: BaseTransformer[T]

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

Modular unit size of transformer expansion of s_nom. 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.

TransformerOptimizationStaticResults

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, tap_ratio for transformers 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 x, tap_ratio for transformers and n.buses.v_nom.

TransformerBaseDynamicResults

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).

TransformerOptimizationDynamicResults

Bases: TransformerBaseDynamicResults

mu_lower: pandas.DataFrame

Shadow price of lower s_nom limit. Always non-negative.

mu_upper: pandas.DataFrame

Shadow price of upper s_nom limit. Always non-negative.

TransformerPfDynamicResults

TransformerNonlinearPfDynamicResults

Bases: TransformerPfDynamicResults

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).