Skip to contents

Between regions (trade, AC lines, DC links) and with the rest of the world (import, export)

PDF, A4, 2 pages · energyRt 0.91.5.9015 (dev) · 2026-11-29
Build them
TRD_GAS <- newTrade("TRD_GAS", desc = "Gas pipeline",
  commodity = "GAS",
  routes = data.frame(src = c("R1", "R2"),
                      dst = c("R2", "R3")),
  trade = data.frame(src = c("R1", "R2"),
    dst = c("R2", "R3"),
    teff = c(0.98, 0.97)),        # delivered share
  capacity = data.frame(stock = 10),
  invcost = data.frame(region = c("R1", "R2"),
    invcost = c(500, 600)),       # per endpoint
  cap2act = 1, olife = 40)
TBD_ELC_R1_R2 <- newACLine("TBD_ELC_R1_R2", commodity = "ELC",
  from = "R1", to = "R2", reactance = 0.1,
  trade = data.frame(teff = 0.98))
TBD_ELC_R2_R3 <- newDCLink("TBD_ELC_R2_R3", commodity = "ELC",
  from = "R2", to = "R3",
  trade = data.frame(teff = 0.97))
IMP_GAS <- newImport("IMP_GAS", commodity = "GAS",
  import = data.frame(price = 8, imp.up = 200))
EXP_ELC <- newExport("EXP_ELC", commodity = "ELC",
  export = data.frame(price = 40, exp.up = 50))
Drawn

A trade is drawn from one node = (default the first source). Import and export have no capacity: a price and bounds per slice.

The identities
Σroutes flow ≤ cap2act·cap·share(t) -- one capacity for all the routes of an object
flow ≤ af.up·cap2act·cap·share(t) -- per route, a share of capacity; × weather waf.*
flow ≤ ava.up -- per route, an absolute amount per slice
received(dst) = Σ teff·flow + import -- losses on the way
imp ≤ imp.up, Σ imp ≤ res.up -- per slice, and over the horizon
cost += price·imp − price·exp -- the rest of the world at a price

flow, cap, imp, exp = vTradeIr, vTradeCap, vImportRow, vExportRow. Inter-regional trade enters the balance as imports and exports, like the rest of the world.

Trade between regions
newTrade(name, desc, commodity, geoframe, routes, trade, fixom, varom, cluster, invcost, olife, start, end, vintage, capacity, aux, aeff, weather, cap2act, optimizeRetirement, units, misc, ...)
One commodity on directed routes, with one shared capacity.
routes df the directed routes
src source region
dst destination region
trade df vcyt flow per route
src source region, NA = every route
dst destination region, NA = every route
ava.lo/up/fx absolute bounds, units per slice 0/∞/– comm/year
af.lo/up/fx bounds as a share of capacity 0/1/– frac
afs.lo/up/fx bounds over a parent slice, share of capacity 0/∞/– frac
teff share delivered (1 = lossless) 1 frac
reactance line reactance (AC power flow) –
resistance line resistance –
commodity chr the one commodity traded
cap2act num 1 act/cap capacity → annual flow
Lines
newACLine(name, commodity, from, to, reactance, resistance, …)
An AC line: both directions, one route pair, its reactance (for kvl = TRUE power flow).
newDCLink(name, commodity, from, to, bidirectional, …)
A DC link, one or both directions.
lossTranches(shares, loss, …)
Quadratic losses as parallel tranches; pass cluster = and trade = to a line.
Costs
invcost df vcry investment, per endpoint region
invcost overnight cost per unit of capacity 0 cur/cap
wacc cost of capital 0 1/year
payback annuity period 0 years
eac annual cost, given directly 0 cur/cap
retcost early-retirement cost 0 cur/cap
fixom df vcry fixed O&M per unit of capacity per year
fixom cost per capacity per year 0 cur/cap
varom df vcyt per unit of flow, per route
src source region
dst destination region
varom variable cost, into the objective 0 cur/comm
markup paid by importer to exporter; cost-neutral 0 cur/comm
Capacity & life
capacity df vcy stock and bounds by year (no region)
stock existing capacity 0 cap
cap.lo/up/fx bounds on total capacity 0/∞/– cap
ncap.lo/up/fx bounds on new capacity 0/∞/– cap
ret.lo/up/fx bounds on retirement 0/∞/– cap
vintage df c investment windows and lifetimes
vintage label, usually the build year
start first year it can be built –
end last year it can be built –
olife operational life, years 1 years
cluster df parallel parts, e.g. loss tranches
cluster cluster label
desc description
cap.share.fx fixed share of capacity (tranches) –
act.share.lo/up/fx bounds on the share of the flow –/–/–
order display order –
optimizeRetirement lgl let the model retire capacity early
Aux and weather
aux df auxiliary commodities
acomm auxiliary commodity
unit its unit
aeff df vcyt aux flow per unit of flow on a route
acomm auxiliary commodity
src source region
dst destination region
csrc2ainp aux input at the source 0 comm/acomm
csrc2aout aux output at the source 0 comm/acomm
cdst2ainp aux input at the destination 0 comm/acomm
cdst2aout aux output at the destination 0 comm/acomm
weather df vc route rating from a weather series
weather name of the weather object
unit unit expected from the series
src source region
dst destination region
waf.lo/up/fx multiplier on af.* 1/1/– factor
wafs.lo/up/fx multiplier on afs.* 1/1/– factor
The rest of the world
newImport(name, desc, commodity, unit, units, reserve, import, cluster, geoframe, region, misc, ...)
From outside the model, at a price.
import df cryt price and bounds per slice
imp.lo/up/fx bounds on the import flow 0/∞/– comm/year
price price per unit 0 cur/comm
newExport(name, desc, commodity, unit, units, reserve, export, cluster, geoframe, region, misc, ...)
To outside the model; the price is revenue.
export df cryt price and bounds per slice
exp.lo/up/fx bounds on the export flow 0/∞/– comm/year
price price per unit 0 cur/comm
reserve df c cumulative import over the horizon
res.lo/up/fx bounds on the total –/–/–
reserve df c cumulative export over the horizon
res.lo/up/fx bounds on the total –/–/–
cluster df r price steps (asSupplyCurve())
cluster step label
desc description
act.share.lo/up/fx bounds on the step's share –/–/–
order display order –
cluster df r price steps
cluster step label
desc description
act.share.lo/up/fx bounds on the step's share –/–/–
order display order –
Identity, scope, extras
name, desc set name; description -- all three
commodity import, export: the one commodity
region import, export: where it applies, empty = all; a trade's regions come from routes
geoframe geoscale level its regions are given at -- all three
units trade: comm, capacity, activity, currency; import, export: comm, currency
defVal, interpolation per-object defaults and interpolation rules -- all three
misc free list for user data -- all three
Results and maps
vImportIrCost Import costs from other regions ry
vExportIrCost Credits (revenue) for export to other regions ry
vImportTot Total regional import (Ir + ROW) (weighted) cryt
vExportTot Total regional export (Ir + ROW) (weighted) cryt
vTradeIr Total physical trade flows between regions crryt
vExportRow Export to the ROW cryt
vImportRow Import from the ROW cryt
vTradeCap Trade capacity y
vTradeNewCap New trade capacity y
gg_trade_network(object, value, year, …)
Flows between regions, as a network.
gg_trade_map(object, map, level, …)
Routes on the regions' map.
levcost(object, comm, name, ...)
Levelized cost of transport (LCOT) of a trade object.
Recipes
# transmission expansion, up to 5 per year
TBD_ELC_R1_R2 <- update(TBD_ELC_R1_R2,
  capacity = data.frame(ncap.up = 5),
  invcost = data.frame(invcost = 800))
# an import price rising over time
IMP_GAS <- update(IMP_GAS, import = data.frame(
  year = c(2025, 2050),
  price = c(8, 12), imp.up = 200))
# dynamic line rating from a weather series
TBD_ELC_R1_R2 <- update(TBD_ELC_R1_R2, weather = data.frame(
  weather = "WIND_CF", waf.up = 1.2))
# AC power flow (Kirchhoff) on the lines
scen <- interpolate_model(mod,
  name = "KVL", kvl = TRUE)
kvl = TRUE adds the voltage-law cycle constraints over AC lines with a reactance.
Lines, drawn