Moving energy between timeslices: charger, reservoir, discharger -- every slot, every column
PDF, A4, 2 pages · energyRt 0.91.5.9015 (dev) · 2026-11-29Build two
STG_BTR <- newStorage("STG_BTR", desc = "Battery, 6 h",
commodity = "ELC", # all three roles
seff = data.frame(inp.eff = 0.95,
out.eff = 0.95),
invcost = list(out.invcost = 120, # inverter
stg.invcost = 80), # cells
duration = 6, # GWh/GW
vintage = data.frame(olife = 15))
STG_H2 <- newStorage("STG_H2",
desc = "Hydrogen cavern store",
commodity = "H2", # what it HOLDS
input = list(comm = "ELC"), # electrolyser
output = list(comm = "ELC"), # fuel cell
seff = data.frame(inp.eff = 0.70,
out.eff = 0.50),
invcost = list(inp.invcost = 2200,
stg.invcost = 1),
cycle = "ANNUAL", # seasonal
vintage = data.frame(olife = 25))
commodity = fills input, storage and output; naming a role overrides it for that role.Anatomy:
draw(STG_H2)
Three parts, each with its own capacity and cost: charger (input, inp.*), reservoir (storage, stg.*), discharger (output, out.*). A part with nothing declared is not built. When the three commodities differ, inp.eff/out.eff are conversion factors (ELC → H2 → ELC).
The identities
level(t) = stg.eff^share(t)·level(t−1) + inp·inp.eff − out/out.eff + start -- the level carries across slices |
level ≤ stg.af.up·stgCap -- state-of-charge range, also stg.af.lo
|
out ≤ out.af.up·cap2act·outCap·share(t) -- discharging; × weather out.waf.*
|
inp ≤ inp.af.up·cap2act·inpCap·share(t) -- charging; × weather inp.waf.*
|
stgCap = duration·outCap -- energy per power (.lo/.up/.fx) |
inpCap = inp2out·outCap -- charger vs discharger |
inpCap = inp2stg·stgCap -- charging C-rate |
duration is energy per power in the stored commodity's units: hours only when the commodity is in GWh and capacity in GW. level, inp, out = vStorageLevel, vStorageInp, vStorageOut.
Constructor & conventions
newStorage(name, desc, commodity, aux, geoframe, region, start, end, olife, input, output, storage, startLevel, seff, aeff, af, fixom, varom, target, invcost, capacity, cluster, vintage, duration, inp2out, inp2stg, cycle, weather, optimizeRetirement, units, misc, ..., fullYear)One argument per slot, plus
commodity (all roles) and olife, start, end (fill @vintage).
inp. stg. out.
|
the part a column applies to: charger, reservoir, discharger |
v c r y t |
key columns: vintage, cluster, region, year, timeslice |
x.lo/up/fx |
lower, upper, fixed bound; x[.lo/up/fx] = value or bounds |
| default | used where a row is missing; – = not set, ∞ = unbounded |
Parts and commodities
input df the charger -- what fills the store
comm |
commodity charged | ||
unit |
its unit | ||
cap2act |
charger capacity → annual flow | 8760 | act/cap |
storage df the reservoir -- what it holds
comm |
commodity stored | ||
unit |
its unit |
output df the discharger -- what it releases
comm |
commodity discharged | ||
unit |
its unit | ||
cap2act |
discharger capacity → annual flow | 8760 | act/cap |
units df units of the object, for reference and reports
capacity |
capacity unit | ||
activity |
activity unit | ||
currency |
currency of costs |
Ratios between parts
duration df vcry reservoir per unit of discharger
duration[.lo/up/fx] |
energy-to-power ratio; bare = .fx
|
–/0/∞/– | comm/cap |
inp2out df vcry charger per unit of discharger
inp2out[.lo/up/fx] |
charger-to-discharger ratio; bare = .fx
|
–/0/∞/– | factor |
inp2stg df vcry charger per unit of reservoir (C-rate, 1/h)
inp2stg[.lo/up/fx] |
charging C-rate; bare = .fx
|
–/0/∞/– | cap/comm |
Cycle, losses, availability
cycle chr timeframe the level closes in: "ANNUAL" (default) carries across the year; a finer one, e.g. "YDAY", closes every day
startLevel df vcry energy added once per cycle, at its first slice
startLevel |
energy added to the level | 0 | frac |
seff df vcryt efficiencies
stg.eff |
share of the level kept per year (decay) | 1 | frac |
inp.eff |
charging efficiency (or conversion) | 1 | frac |
out.eff |
discharging efficiency (or conversion) | 1 | frac |
af df vcryt availability per slice
stg.af.lo/up/fx |
state of charge, share of reservoir | 0/1/– | frac |
inp.af.lo/up/fx |
charging, share of charger | 0/1/– | frac |
out.af.lo/up/fx |
discharging, share of discharger | 0/1/– | frac |
target df vcryt soft, priced floors on the level
tier |
tier label (tiers stack) | ||
stg.af.target |
floor, share of reservoir | 0 | frac |
stg.af.cost |
cost per unit below the floor | 0 | cur/comm |
weather df vc scales availability by a weather series
weather |
name of the weather object |
||
unit |
unit expected from the series | ||
transform |
derived series from weather@misc$transform
|
||
stg.waf.lo/up/fx |
multiplier on stg.af.*
|
1/1/– | factor |
inp.waf.lo/up/fx |
multiplier on inp.af.*
|
1/1/– | factor |
out.waf.lo/up/fx |
multiplier on out.af.*
|
1/1/– | factor |
Costs
invcost df vcry investment per part
out.invcost |
discharger, per unit of capacity | 0 | cur/cap |
out.wacc |
its cost of capital | 0 | 1/year |
out.payback |
its annuity period | 0 | years |
out.eac |
its annual cost, given directly | 0 | cur/cap |
out.retcost |
its early-retirement cost | 0 | cur/cap |
inp.invcost |
charger, per unit of capacity | 0 | cur/cap |
inp.wacc |
its cost of capital | 0 | 1/year |
inp.payback |
its annuity period | 0 | years |
inp.eac |
its annual cost, given directly | 0 | cur/cap |
inp.retcost |
its early-retirement cost | 0 | cur/cap |
stg.invcost |
reservoir, per unit of energy | 0 | cur/cap |
stg.wacc |
its cost of capital | 0 | 1/year |
stg.payback |
its annuity period | 0 | years |
stg.eac |
its annual cost, given directly | 0 | cur/cap |
stg.retcost |
its early-retirement cost | 0 | cur/cap |
fixom df vcry fixed O&M per part, per unit of capacity per year
out.fixom |
discharger | 0 | cur/cap |
inp.fixom |
charger | 0 | cur/cap |
stg.fixom |
reservoir | 0 | cur/cap |
varom df vcryt variable O&M per unit of flow or level
inp.varom |
per unit charged | 0 | cur/comm |
out.varom |
per unit discharged | 0 | cur/comm |
stg.varom |
per unit of level held | 0 | cur/comm |
Stock & life
capacity df vcry stock and bounds per part, by year
out.stock |
existing discharger capacity | 0 | cap |
out.cap.lo/up/fx |
total discharger capacity | 0/∞/– | cap |
out.ncap.lo/up/fx |
new discharger capacity | 0/∞/– | cap |
out.ret.lo/up/fx |
discharger retirement | 0/∞/– | cap |
inp.stock |
existing charger capacity | 0 | cap |
inp.cap.lo/up/fx |
total charger capacity | 0/∞/– | cap |
inp.ncap.lo/up/fx |
new charger capacity | 0/∞/– | cap |
inp.ret.lo/up/fx |
charger retirement | 0/∞/– | cap |
stg.stock |
existing reservoir capacity | 0 | cap |
stg.cap.lo/up/fx |
total reservoir capacity | 0/∞/– | cap |
stg.ncap.lo/up/fx |
new reservoir capacity | 0/∞/– | cap |
stg.ret.lo/up/fx |
reservoir retirement | 0/∞/– | cap |
vintage df cr investment windows and lifetimes
vintage |
label, usually the build year | ||
start |
first year it can be built | – | year |
end |
last year it can be built | – | year |
olife |
operational life, years | 1 | years |
cluster df r parallel sub-processes (see Clusters & vintages)
cluster |
cluster label | ||
desc |
description | ||
cap.share.fx |
fixed share of the family's capacity | – | |
act.share.lo/up/fx |
bounds on the share of its throughput | –/–/– | |
order |
display and ranking order | – |
optimizeRetirement lgl let the model retire capacity early
Auxiliary flows
aux df auxiliary commodities
acomm |
auxiliary commodity | ||
unit |
its unit |
aeff df vcryt aux flow = coefficient × driver
acomm |
auxiliary commodity | ||
| per flow or level | |||
stg2ainp |
per unit of level → aux input | 0 | comm/acomm |
stg2aout |
per unit of level → aux output | 0 | comm/acomm |
cinp2ainp |
per unit charged → aux input | 0 | comm/acomm |
cinp2aout |
per unit charged → aux output | 0 | comm/acomm |
cout2ainp |
per unit discharged → aux input | 0 | comm/acomm |
cout2aout |
per unit discharged → aux output | 0 | comm/acomm |
| per capacity, by part | |||
inp.cap2ainp |
per charger capacity → aux input | 0 | cap/acomm |
inp.cap2aout |
per charger capacity → aux output | 0 | cap/acomm |
stg.cap2ainp |
per reservoir capacity → aux input | 0 | cap/acomm |
stg.cap2aout |
per reservoir capacity → aux output | 0 | cap/acomm |
out.cap2ainp |
per discharger capacity → aux input | 0 | cap/acomm |
out.cap2aout |
per discharger capacity → aux output | 0 | cap/acomm |
| per new capacity, once | |||
inp.ncap2ainp |
per new charger, once → aux input | 0 | cap/acomm |
inp.ncap2aout |
per new charger, once → aux output | 0 | cap/acomm |
stg.ncap2ainp |
per new reservoir, once → aux input | 0 | cap/acomm |
stg.ncap2aout |
per new reservoir, once → aux output | 0 | cap/acomm |
out.ncap2ainp |
per new discharger, once → aux input | 0 | cap/acomm |
out.ncap2aout |
per new discharger, once → aux output | 0 | cap/acomm |
ncap2stg |
first fill of new reservoir → level | 0 | comm/cap |
| end of life / early retirement | |||
pho2ainp |
at end of life → aux input | 0 | cap/acomm |
pho2aout |
at end of life → aux output | 0 | cap/acomm |
ret2ainp |
retired early → aux input | 0 | cap/acomm |
ret2aout |
retired early → aux output | 0 | cap/acomm |
Identity, scope, extras
name chr set name
desc chr description for reports
region chr regions where it may be built; empty = all
geoframe chr geoscale level its regions are given at
defVal df per-object default, e.g. defVal$out.eff <- 0.9
interpolation df per-object interpolation rule
misc list free list for user data
Recipes
# a daily battery: the level closes
# every day, nothing crosses midnight
STG_BTR <- update(STG_BTR, cycle = "YDAY")
# a store that is never emptied below 20%
STG_H2 <- update(STG_H2, af = data.frame(
stg.af.lo = 0.2))
# keep 30% in reserve, at a price
STG_H2 <- update(STG_H2, target = data.frame(
stg.af.target = 0.3,
stg.af.cost = 50))
# a 4-8 hour range left to the model
STG_BTR <- update(STG_BTR, duration = data.frame(
duration.lo = 4, duration.up = 8))Results and tools
vStorageInp |
Storage input | cryt |
vStorageOut |
Storage output | cryt |
vStorageLevel |
Storage level | cryt |
vStorageOutCap |
Storage capacity | ry |
vStorageOutNewCap |
Storage new capacity | ry |
vStorageStgCap |
Storage energy (storing) capacity | ry |
vStorageInpCap |
Storage charging (input) capacity | ry |
vStorageStgNewCap |
Storage new energy (storing) capacity | ry |
storage_duration(object, width, …)How long energy stays stored, in bands of duration, from a solved scenario.
getData(scen, name = "vStorageLevel",
stg = "STG_H2", merge = TRUE)More stores, drawn
STG_HEAT <- newStorage("STG_HEAT",
desc = "Heat store, electric heater",
commodity = "HEAT",
input = list(comm = "ELC"),
seff = data.frame(inp.eff = 0.98,
stg.eff = 0.6), # 40%/yr lost
invcost = list(inp.invcost = 150,
stg.invcost = 20))
