Post · 6 min read· pp. 535–540

Transformer

The Transformer components represent 2-winding transformers that convert AC power from one voltage level to another. They connect a bus0 (typically at higher voltage) to a bus1 (typically at lower voltage). Power flow through transformers is not directly controllable, but is determined passively by their impedances and the nodal power imbalances. To see how the impedances are used in the power flow, see the transformer model.

attributetypeunitdefaultdescriptionstatus
namestringnannanUnique nameInput (required)
bus0stringnannanName of origin bus (typically higher voltage) to which transformer is attached.Input (required)
bus1stringnannanName of destination bus (typically lower voltage) to which transformer is attached.Input (required)
typestringnannanName of 2-winding transformer standard type. If this is not an empty string "", the transformer type impedance parameters are taken from the standard type along with num_parallel. This will override any values set in r, x, g, b, s_nom, tap_ratio, tap_side and phase_shift. If the string is empty, values manually provided for r, x, etc. are taken.Input (optional)
modelstringnantModel used for admittance matrix; can be "t" or "pi"; defaults to "t" following physics and DIgSILENT PowerFactoryInput (required)
xfloatper unit0Series reactance (per unit, using s_nom as base power and v_nom as base voltage); must be non-zero for AC branch in linear power flow. Series impedance z=r+jxz = r + jx must be non-zero for the non-linear power flow. Ignored if type defined.Input (required)
rfloatper unit0Series resistance (per unit, using s_nom as base power and v_nom as base voltage); must be non-zero for DC branch in linear power flow. Series impedance z=r+jxz = r + jx must be non-zero for the non-linear power flow. Ignored if type defined.Input (required)
gfloatper unit0Shunt conductivity (per unit, using s_nom as base power and v_nom as base voltage). Ignored if type defined.Input (optional)
bfloatper unit0Shunt susceptance (per unit, using s_nom as base power and v_nom as base voltage). Ignored if type defined.Input (optional)
s_nomfloatMVA0Limit of apparent power which can pass through branch in either direction. Ignored if s_nom_extendable=True.Input (optional)
s_nom_modfloatMVA0Modular unit size of transformer expansion of s_nom. Introduces integer variables.Input (optional)
s_nom_extendablebooleannanFalseSwitch to allow capacity s_nom to be extended in optimisation.Input (optional)
s_nom_minfloatMVA0If s_nom_extendable=True, set the minimum value of s_nom_opt.Input (optional)
s_nom_maxfloatMVAinfIf s_nom_extendable=True, set the maximum value of s_nom_opt.Input (optional)
s_nom_setfloatMVAnanIf s_nom is extendable in optimization, set the value of s_nom_opt.Input (optional)
s_max_pustatic or seriesper unit1The maximum allowed absolute flow per unit of s_nom for the oprimisation.Input (optional)
capital_costfloatcurrency/MVA0Fixed period costs of extending s_nom by 1 MVA (e.g. annuitized investment costs). Used directly unless overnight_cost is specified.Input (optional)
overnight_costfloatcurrency/MVAnanOvernight (upfront) investment cost per MVA. If specified, PyPSA calculates annuity using discount_rate and lifetime. Takes precedence over capital_cost.Input (optional)
discount_ratefloatper unitnanDiscount rate for annuity calculation when using overnight_cost. Supports 0% rate (simple depreciation).Input (optional)
fom_costfloatcurrency/MVA0Fixed period operation and maintenance costs, added to annuitized investment cost.Input (optional)
num_parallelfloatnan1When type is set, this is the number of parallel transformers (can also be fractional). If type is empty "" this value is ignored.Input (optional)
tap_ratiofloatper unit1Ratio of per unit voltages at each bus for tap changed. Ignored if type defined.Input (optional)
tap_sideintnan0Defines 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). Ignored if type defined.Input (optional)
tap_positionintnan0If the transformer has a type, the absolute tap position on the same scale as tap_min/tap_neutral/tap_max. The off-nominal voltage ratio is computed from the offset to tap_neutral, so the nominal ratio (tap_ratio = 1) is obtained when tap_position == tap_neutral.Input (optional)
phase_shiftstatic or seriesDegrees0Voltage phase angle shift setpoint. Ignored if type defined. Sign convention follows pf/lpf: the realised flow is P = (theta0 - theta1 - phase_shift) / x, so the KVL cycle constraint reads sum_l C_lk * (x_l * P_l + phase_shift_l) = 0 (in rad). This is the negative of the angle convention in Verboomen 2008 (= -alpha_Verboomen); do not flip the sign towards the paper or LOPF will diverge from pf/lpf (issue #1220). When phase_shift_min < phase_shift_max the shift becomes a per-snapshot decision variable instead and phase_shift is ignored.Input (optional)
phase_shift_minfloatDegrees0Lower bound (degrees) for the per-snapshot phase shift. When phase_shift_min < phase_shift_max the shift is optimised as a decision variable bounded by phase_shift_min/phase_shift_max (e.g. a phase-shifting transformer whose tap the TSO optimises); otherwise the shift is fixed to phase_shift.Input (optional)
phase_shift_maxfloatDegrees0Upper bound (degrees) for the per-snapshot phase shift. See phase_shift_min.Input (optional)
activebooleannanTrueWhether to consider the component in optimisation or notInput (optional)
build_yearintyear0Build year of transformer.Input (optional)
lifetimefloatyearsinfLifetime of transformer.Input (optional)
v_ang_minfloatDegrees-infDeprecated and ignored. v_ang_max applies symmetrically as an absolute voltage angle difference limit.Input (optional)
v_ang_maxfloatDegreesinfMaximum magnitude of the voltage angle difference across the transformer in degrees. Enforced in the optimisation as a symmetric cap on the angle difference including the phase shift. Ignored when inf.Input (optional)
sub_networkstringnannanName of connected sub-network to which transformer belongs, as calculated by n.determine_network_topology(). Do not set by hand.Output
p0seriesMW0Active power at bus0 (positive if branch is withdrawing power from bus0).Output
q0seriesMVar0Reactive power at bus0 (positive if branch is withdrawing power from bus0).Output
p1seriesMW0Active power at bus1 (positive if branch is withdrawing power from bus1).Output
q1seriesMVar0Reactive power at bus1 (positive if branch is withdrawing power from bus1).Output
x_pufloatper unit0Per unit series reactance rescaled to a 1 MVA base power by n.calculate_dependent_values() from x via x_pu = x / s_nom.Output
r_pufloatper unit0Per unit series resistance rescaled to a 1 MVA base power by n.calculate_dependent_values() from r via r_pu = r / s_nom.Output
g_pufloatper unit0Per unit shunt conductivity rescaled to a 1 MVA base power by n.calculate_dependent_values() from g via g_pu = g * s_nom.Output
b_pufloatper unit0Per unit shunt susceptance rescaled to a 1 MVA base power by n.calculate_dependent_values() from b via b_pu = b * s_nom.Output
x_pu_efffloatper unit0Effective per unit series reactance for linear power flow, calculated by n.calculate_dependent_values() from x_pu and tap_ratio via x_pu_eff = x_pu * tap_ratio.Output
r_pu_efffloatper unit0Effective per unit series resistance for linear power flow, calculated by n.calculate_dependent_values() from r_pu and tap_ratio via r_pu_eff = r_pu * tap_ratio.Output
s_nom_optfloatMVA0Optimised nominal capacity for apparent power.Output
mu_lowerseriescurrency/MVA0Shadow price of lower s_nom limit. Always non-negative.Output
mu_upperseriescurrency/MVA0Shadow price of upper s_nom limit. Always non-negative.Output
phase_shift_optseriesDegrees0Realised per-snapshot voltage phase angle shift. Equals phase_shift for fixed transformers; for optimised transformers (phase_shift_min < phase_shift_max) it holds the value chosen by n.optimize().Output

diagram 2025-10-22

diagram 2025-10-09