gtopt::Line struct

Represents a transmission line (branch) connecting two buses.

A line carries active power flow f ∈ [-tmax_ba, tmax_ab] between bus_a and bus_b. In Kirchhoff mode the flow is constrained by f = V² / X · (θ_a − θ_b) where V is the line voltage and X the reactance. When voltage is omitted (defaults to 1.0) both V and X are in per-unit; when voltage is in kV, reactance must be in Ω. Optional expansion variables allow the solver to invest in additional transfer capacity.

Public functions

auto line_losses_mode_enum() const -> constexpr std::optional<LineLossesMode> noexcept
Parse line_losses_mode string to enum (nullopt = inherit from global).
auto loss_allocation_mode_enum() const -> constexpr LossAllocationMode noexcept
Parse loss_allocation_mode string to enum (receiver if unset).

Public variables

OptActive active
Activation status (default: active)
OptTRealFieldSched annual_capcost
Annualized investment cost [$/MW-year].
OptTRealFieldSched annual_derating
Annual capacity derating factor [p.u./year].
SingleId bus_a
Sending-end (from) bus ID.
SingleId bus_b
Receiving-end (to) bus ID.
OptTRealFieldSched capacity
Installed transfer capacity [MW].
OptTRealFieldSched capmax
Absolute maximum capacity after expansion [MW].
OptTRealFieldSched expcap
Capacity added per expansion module [MW].
OptTRealFieldSched expmod
Maximum number of expansion modules [dimensionless].
OptName line_losses_mode
OptName loss_allocation_mode
OptInt loss_segments
OptTRealFieldSched lossfactor
Lumped loss factor [p.u.].
Name name
Line name.
OptTRealFieldSched phase_shift_deg
OptTRealFieldSched reactance
OptTRealFieldSched resistance
OptTRealFieldSched tap_ratio
OptTRealFieldSched tcost
Variable transmission cost [$/MWh].
OptTBRealFieldSched tmax_ab
Maximum power flow in A→B direction [MW].
OptTBRealFieldSched tmax_ba
Maximum power flow in B→A direction [MW].
OptName type
Optional line type tag (e.g. "ac", "dc", "transformer")
Uid uid
Unique identifier.
OptBool use_line_losses deprecated
OptTRealFieldSched voltage

Variable documentation

OptName gtopt::Line::line_losses_mode

Loss model selection (per-line override). See LineLossesMode for valid values: "none", "linear", "piecewise", "bidirectional", "adaptive", "dynamic". When unset, inherits from ModelOptions.

OptName gtopt::Line::loss_allocation_mode

How losses are allocated between sender and receiver buses: "receiver" (default), "sender", or "split" (50/50, PLP default).

OptInt gtopt::Line::loss_segments

Number of piecewise-linear segments for quadratic losses (default: from Options)

OptTRealFieldSched gtopt::Line::phase_shift_deg

Phase-shift angle [degrees]. Models a phase-shifting transformer (PST) by adding a constant angle offset φ to the Kirchhoff equality constraint: f = B_eff · (θ_a − θ_b − φ). Positive values reduce the natural power flow from bus_a to bus_b. Defaults to 0.0.

OptTRealFieldSched gtopt::Line::reactance

Series reactance for DC power flow [Ω]. Use p.u. when voltage is omitted (default). Susceptance: B = V² / X.

OptTRealFieldSched gtopt::Line::resistance

Series resistance [Ω]. Use p.u. when voltage is omitted.

OptTRealFieldSched gtopt::Line::tap_ratio

Off-nominal tap ratio [p.u.]. For transformers only; ignored for plain lines. When set to a value other than 1.0 the effective susceptance of the branch in the DC power-flow (Kirchhoff) constraint is scaled by 1/tap_ratio, i.e. B_eff = V²/(tap_ratio · X). Defaults to 1.0 (nominal tap, no correction).

OptBool gtopt::Line::use_line_losses

OptTRealFieldSched gtopt::Line::voltage

Nominal voltage level [kV]. Omit or set to 1.0 for per-unit mode.