
Cheat sheet: Clusters & vintages
Source:vignettes/articles/cheatsheet-variants.Rmd
cheatsheet-variants.RmdOne object, a family of processes: build years (vintages) and parallel grades (clusters)
PDF, A4, 2 pages · energyRt 0.91.5.9015 (dev) · 2026-11-29EGAS <- newTechnology("EGAS", desc = "Gas plant",
input = data.frame(comm = "GAS"),
output = data.frame(comm = "ELC"),
vintage = data.frame(
vintage = c("2025", "2035"),
start = c(2025, 2035), # first build year
end = 2050, # last build year
olife = 30), # life once built
ceff = data.frame(vintage = c("2025", "2035"),
comm = "ELC", cact2cout = c(0.40, 0.55)),
invcost = data.frame(vintage = c("2025", "2035"),
invcost = c(1200, 900)),
capacity = data.frame(cap.up = 400), # both
cap2act = 8.76)
draw(EGAS, vintage = "2035")Sequential: a vintage differs in when it is built. start/end is the investment window, olife the life after. Windows may overlap; the model picks.
EWIN <- newTechnology("EWIN", desc = "Wind",
output = data.frame(comm = "ELC"),
cluster = data.frame(
cluster = c("01", "02", "03"),
desc = c("best", "average", "leftovers"),
order = 1:3),
af = data.frame(cluster = c("01", "02", "03"),
af.up = c(0.45, 0.33, 0.22)),
capacity = data.frame(
cluster = c("01", "02", "03"),
cap.up = c(8, 16, 40)), # GW by grade
invcost = data.frame(
cluster = c("01", "02", "03"),
invcost = c(600, 900, 1800)),
vintage = data.frame(olife = 25),
cap2act = 8.76)
draw(EWIN, cluster = "02", cluster_style = "rail")Simultaneous: clusters coexist and differ in what they are -- a grade, a site class, a tranche. Labels are zero-padded ordinals for tiers; desc says what one means.
ECOA <- newTechnology("ECOA",
input = data.frame(comm = "COA"),
output = data.frame(comm = "ELC"),
vintage = data.frame(vintage = c("2025", "2035"),
start = c(2025, 2035), end = 2050, olife = 40),
cluster = data.frame(cluster = c("PLAIN", "CCS")),
ceff = data.frame( # NA = every member
vintage = c(NA, NA, "2035"),
cluster = c("PLAIN", "CCS", "CCS"),
comm = "ELC", cact2cout = c(0.42, 0.33, 0.36)),
invcost = data.frame(invcost = 1500),
cap2act = 8.76)
draw(ECOA, vintage = "2035", cluster = "CCS", cluster_style = "deck")
EGAS + vintage 2035 |
EGAS_VIN2035 |
EWIN + cluster 01 |
EWIN_CL01 |
ECOA + 2035 + CCS |
ECOA_VIN2035_CLCCS |
Expanded at interpolation into one ordinary process per member; the solver never sees the family. Prefixes: newModel(variant_prefix = c(cluster = "_T")).
| roster | every label used in a slot must be declared in @vintage / @cluster; a typo is an error, not a free extra member |
NA selector |
the row applies to every member on that axis |
"TOTAL" |
a selector of "TOTAL" bounds the family, across its members |
| labels |
"01", "02" for tiers (sort, and tie objects of one tier together); kinds may be words ("CCS") |
| names | member names are data: pick variant_prefix once per model |
@vintage on: technology, storage, trade, tax, subsidy
@cluster on: commodity, supply, demand, technology, storage, trade, import, export, weather, tax, subsidy
vintage df cr build windows and life; one row per vintage
vintage |
label, usually the build year | ||
start |
first year it can be built (NA = from the start) |
– | year |
end |
last year it can be built | – | year |
olife |
operational life, years | 1 | years |
Every data slot of a vintaged object takes a vintage column. newTechnology(olife =, start =, end =) fill a one-row table.
cluster df r members, their scope and their shares
cluster |
cluster label | ||
desc |
what the member is, for reports | ||
cap.share.fx |
fixed share of the family's capacity, every year | – | |
act.share.lo/up/fx |
bounds on the member's share of the family's throughput | –/–/– | |
order |
display and ranking order | – |
cap.share.fx |
ties capacities: loss tranches, where each tranche's efficiency belongs to its place in the stack |
act.share.* |
ties throughput: stops a family collapsing onto its cheapest member |
A region column scopes a member (intersected with the object's region): grade 02 in R1 only = one row cluster = "02", region = "R1". supply, demand, import, export have no capacity, so no cap.share.fx.
ECOA35 <- newConstraint("ECOA35", eq = "<=",
cap = list(variable = "vTechCap",
process_ = "^ECOA", vintage = "2035"),
for.each = data.frame(year = 2040),
rhs = 100)
A base name expands to all its members; terms and levies (newTax(), newSubsidy()) select by vintage, cluster, or the regex forms vintage_, cluster_, process_.
getVariants(object, class)getData(scen, name = "vTechCap",
variants = TRUE, merge = TRUE)
autoplot(scen, type = "capacity",
comm = "ELC", by = "cluster")
variants = TRUE adds base, vintage, cluster columns.levcost(EWIN, by_variant = TRUE)
The commodity balance has no cluster key: three supply grades of one LAND pool together. Put the tiers on the resource -- commodity or weather -- and the consumers read theirs by label.
LAND <- newCommodity("LAND", unit = "kha",
timeframe = "ANNUAL",
cluster = data.frame(
cluster = c("01", "02", "03")))
RES_LAND <- newSupply("RES_LAND",
commodity = "LAND",
cluster = data.frame(
cluster = c("01", "02", "03")),
supply = data.frame(
cluster = c("01", "02", "03"),
ava.up = 4, cost = c(1, 2, 3)))
LAND_CL01..03, each with its own balance; EWIN_CL01 draws only LAND_CL01.tiers <- c("01", "02", "03")
WWIN <- newWeather("WWIN",
cluster = data.frame(cluster = tiers),
weather = data.frame(cluster = tiers,
wval = c(0.40, 0.30, 0.20)))
EWIN2 <- update(EWIN,
weather = data.frame(cluster = tiers,
weather = "WWIN", waf.up = 1))
Commodity tiers may differ in data: @emis, @agg, @property take a cluster column (anthracite vs lignite).
STG_BTR <- newStorage("STG_BTR", commodity = "ELC",
vintage = data.frame(
vintage = c("2025", "2035"),
start = c(2025, 2035), end = 2050,
olife = 15),
seff = data.frame(
vintage = c("2025", "2035"),
out.eff = c(0.92, 0.95)),
invcost = data.frame(
vintage = c("2025", "2035"),
stg.invcost = c(300, 150)))
@vintage and @cluster like a technology; storage columns keep their inp./stg./out. prefix.lt <- lossTranches(
shares = c(0.4, 0.35, 0.25),
loss = 0.03) # 3% lost at full load
TBD_ELC_R1_R2 <- newACLine("TBD_ELC_R1_R2", commodity = "ELC",
from = "R1", to = "R2", reactance = 0.1,
cluster = lt$cluster, trade = lt$trade)
cap.share.fx).lossTranches(shares, loss, resistance, capacity, …)cap.share.fx).get_process_groups(x, regions)process_cluster_sweep(object, group, ks, …)- A tier roster must cover every tier a consumer asks for; asking a clustered weather or commodity for an undeclared tier is an error.
- A link to a clustered resource without a cluster is an error: a multiplicative factor has no "all tiers" reading.
- Not to be confused:
aggregate_model_regions(clusters = )groups regions; it never touches process clusters. - Per-member results come from
getData(); fold them withvariantSummary()or thevariants = TRUEcolumns, never by parsing names.