Skip to content

LinkΒΆ

The Link components are used for controllable directed flows between two or more buses with arbitrary energy carriers (bus0, bus1, bus2, etc.). For instance, they can represent point-to-point HVDC links, unidirectional lossy HVDC links, converters between AC and DC, net transfer capacities (NTCs) of HVAC lines (neglecting Kirchhoff's voltage law), as well as any conversion between carriers (e.g. electricity to hydrogen in electrolysis, electricity to heat in heat pumps, or gas to electricity and heat in a combined heat and power (CHP) plant).

  • The Link component has one dispatch variable p0 associated with the input from bus0 (positive if withdrawing from bus0) and one or more outputs p1, p2, etc. associated with the output at bus1, bus2, etc. (negative if supplying to these buses). The outputs at bus1, bus2, etc. are proportional to the input at bus0 multiplied by the corresponding efficiency (e.g. efficiency, efficiency2, etc.). That means that the link can have multiple outputs in fixed ratio to the input.

  • The columns bus2, efficiency2, bus3, efficiency3, etc. in n.links are automatically added to the component attributes.

  • Any marginal_cost are related to the input p0 at bus0 (e.g. cost per unit of fuel consumed rather than cost per unit of electricity produced for a power plant).

  • For links with multiple inputs in fixed ratio to one of the inputs, you can define the other inputs as outputs with a negative efficiency so that they withdraw from the corresponding bus if there is a positive flow for p0.

  • For delayed energy transport, use the attribute delay, delay2, ... which postpones the output at bus1, bus2, ... in terms of elapsed time, taking snapshot weightings into account. See this example.

When to use Line instead?

Use the Line component type for power lines for which their power flow is determined passively through Kirchhoff's voltage law.

Link with bidirectional lossless flow

Because the Link component can have efficiency losses and marginal costs, the default settings allow only for flow in one direction (p_min_pu=0), from bus0 to bus1. To build a bidirectional lossless link, set efficiency = 1, marginal_cost = 0 and p_min_pu = -1.

n.add(
    "Link",
    "bidirectional-link",
    bus0="bus-A",
    bus1="bus-B",
    p_nom=1000,
    efficiency=1,
    marginal_cost=0,
    p_min_pu=-1,
)

Link with a single input and multiple outputs

Suppose a link representing a combined heat and power (CHP) plant takes as input 1 unit of fuel and gives as outputs 0.3 units of electricity and 0.7 units of heat. Then bus0 connects to the fuel, bus1 connects to electricity with efficiency=0.3 and bus2 connects to heat with efficiency2=0.7. This example illustrates a CHP with a fixed power-heat ratio using links.

n.add(
    "Link",
    "CHP",
    bus0="gas",
    bus1="electricity",
    bus2="heat",
    efficiency=0.3,    # 0.3 units of electricity per unit of gas
    efficiency2=0.7,   # 0.7 units of heat per unit of gas
    p_nom_extendable=True,
    capital_cost=50,   # cost per MW of gas input
)

Link with multiple inputs and a single output

Suppose a link representing a methanation process takes as inputs one unit of hydrogen and 0.5 units of carbon dioxide, and gives as outputs 0.8 units of methane and 0.2 units of heat. Then bus0 connects to hydrogen, bus1 connects to carbon dioxide with efficiency=-0.5 (since 0.5 units of carbon dioxide is taken for each unit of hydrogen), bus2 connects to methane with efficiency2=0.8 and bus3 to heat with efficiency3=0.2. This example illustrates many modelling processes with multiple inputs and outputs using links.

n.add(
    "Link",
    "methanation",
    bus0="hydrogen",
    bus1="CO2",
    bus2="methane",
    bus3="heat",
    efficiency=-0.5,   # consumes 0.5 units of CO2 per unit of hydrogen
    efficiency2=0.8,   # produces 0.8 units of methane
    efficiency3=0.2,   # produces 0.2 units of heat
    p_nom_extendable=True,
    capital_cost=100,  # cost per MW of hydrogen input
)
attribute type unit default description status
name string nan nan Unique name Input (required)
bus0 string nan nan Name of origin bus to which link is attached. Input (required)
bus1 string nan nan Name of first destination bus to which link is attached. Further destination buses (bus2, bus3, etc.) are automatically expanded as needed. Input (required)
type string nan nan Placeholder for link type. Not implemented. Input (optional)
carrier string nan nan Carrier of the link describing its technology (e.g. gas boiler, electrolyser, HVDC link). Input (optional)
efficiency static or series per unit 1 Efficiency of energy transfer from bus0 to bus1. Can be time-dependent (e.g. to represent temperature-dependent heat pump COP). Further efficiency attributes for further buses (e.g. bus2, bus3, etc.) are automatically expanded as needed (e.g. efficiency2, efficiency3, etc.). Input (optional)
active boolean nan True Whether to consider the component in basic functionality or not Input (optional)
build_year int year 0 Build year Input (optional)
lifetime float years inf Lifetime Input (optional)
p_nom float MW 0 Limit of power which can pass through link (in units of bus0). Ignored if p_nom_extendable=True. Input (optional)
p_nom_mod float MW 0 Unit size of link module (e.g. fixed blocks of 100 MW). Input (optional)
p_nom_extendable boolean nan False Switch to allow capacity p_nom to be extended. Input (optional)
p_nom_min float MW 0 If p_nom_extendable=True, set its minimum value. Input (optional)
p_nom_max float MW inf If p_nom_extendable=True, set its maximum value. Input (optional)
p_nom_set float MW nan If p_nom is extendable in optimization, set its value. Input (optional)
p_set static or series MW nan The dispatch set point for p0 of the link (for optimisation and power flow). Input (optional)
p_init static MW nan Active power used as a starting point for limiting the ramp in the very first snapshot (for optimisation) Input (optional)
p_min_pu static or series per unit of p_nom 0. Minimal dispatch per unit of p_nom for the link. Can also be negative. Input (optional)
p_max_pu static or series per unit of p_nom 1. Maximal dispatch per unit of p_nom for the link. Can also be negative. Input (optional)
capital_cost float currency/MW 0 Fixed period costs of extending p_nom by 1 MW (unit of bus0, e.g. annuitized investment costs). Used directly unless overnight_cost is specified. Any length factor must already be included. Input (optional)
overnight_cost float currency/MW nan Overnight (upfront) investment cost per MW (unit of bus0). If specified, PyPSA calculates annuity using discount_rate and lifetime. Takes precedence over capital_cost. Input (optional)
discount_rate float per unit nan Discount rate for annuity calculation when using overnight_cost. Supports 0% rate (simple depreciation). Input (optional)
fom_cost float currency/MW 0 Fixed period operation and maintenance costs per MW (unit of bus0), added to annuitized investment cost. Input (optional)
marginal_cost static or series currency/MWh 0. Marginal cost of 1 MWh consumption from bus0 (e.g. including variable operation and maintenance costs of an electrolyser but excluding electricity costs). Input (optional)
marginal_cost_quadratic static or series currency/MWh 0. Quadratic marginal cost for 1 MWh of consumption from bus0. Input (optional)
stand_by_cost static or series currency/h 0. Stand-by cost for operating the link. This cost is incurred whenever the status is 1 (including when dispatch decision is zero). Input (optional)
length float km 0 Length of the link. Useful for calculating capital_cost for HVDC connections. Input (optional)
terrain_factor float per unit 1 Terrain factor for increasing capital_cost calculated from length. Input (optional)
committable boolean nan False Apply unit commitment constraints. Input (optional)
start_up_cost float currency 0 Cost to start up the link. Only used if committable=True. Input (optional)
shut_down_cost float currency 0 Cost to shut down the link. Only used if committable=True. Input (optional)
min_up_time int snapshots 0 Minimum number of snapshots for status to be 1. Only used if committable=True. Does not consider snapshot weightings. Input (optional)
min_down_time int snapshots 0 Minimum number of snapshots for status to be 0. Only used if committable=True. Does not consider snapshot weightings. Input (optional)
up_time_before int snapshots 1 Number of snapshots that the link was online before network.snapshots start. Only read if committable=True and min_up_time>0. Does not consider snapshot weightings. Input (optional)
down_time_before int snapshots 0 Number of snapshots that the link was offline before network.snapshots start. Only read if committable=True and min_down_time>0. Does not consider snapshot weightings. Input (optional)
ramp_limit_up static or series per unit nan Maximum increase from one snapshot to the next, per unit of p_nom. Ignored if NaN. Does not consider snapshot weightings. Input (optional)
ramp_limit_down static or series per unit nan Maximum decrease from one snapshot to the next, per unit of p_nom. Ignored if NaN. Does not consider snapshot weightings. Input (optional)
ramp_limit_start_up float per unit nan Maximum increase at start up, per unit of p_nom. Only used if committable=True. Ignored if NaN. Input (optional)
ramp_limit_shut_down float per unit nan Maximum decrease at shut down, per unit of p_nom. Only used if committable=True. Ignored if NaN. Input (optional)
delay int snapshot weighting units 0 Delay of energy delivery to bus1 in units of n.snapshot_weightings.generators. Energy withdrawn from bus0 at snapshot t arrives at the first snapshot whose cumulative generator weighting start is at least delay units later. Auto-expanded as delay2, delay3, etc. for additional ports. Input (optional)
cyclic_delay boolean nan True Whether delayed energy wraps cyclically from end to start of the optimization period. If False, energy is lost at the tail and first snapshots receive nothing from delayed links. Auto-expanded as cyclic_delay2, cyclic_delay3, etc. for additional ports. Input (optional)
p series MW 0. Internal power (positive if link is withdrawing from bus0). Output
p0 series MW 0. Power at bus0 (positive if link is withdrawing from bus0). Output
p1 series MW 0. Power at bus1 (positive if link is withdrawing from bus1). Output
p_nom_opt float MW 0 Optimised nominal capacity. Output
status series nan 1. Status in the snapshot (1 is on, 0 is off). Only returned if committable=True. Output
start_up series nan 1. Whether the unit was started in the snapshot (1 is yes, 0 is no). Only returned if committable=True. Output
shut_down series nan 1. Whether the unit was shut down in the snapshot (1 is yes, 0 is no). Only returned if committable=True. Output
mu_lower series currency/MW nan Shadow price of lower p_nom limit \(-F \leq f\). Always non-negative. Output
mu_upper series currency/MW nan Shadow price of upper p_nom limit \(f \leq F\). Always non-negative. Output
mu_p_set series currency/MWh nan Shadow price of fixed dispatch p_set Output
mu_ramp_limit_up series currency/MWh nan Shadow price of upper ramp up limit Output
mu_ramp_limit_down series currency/MWh nan Shadow price of lower ramp down limit Output