Skip to contents

The cost of a unit of output: before solving, from an object and the prices around it; after solving, from what the model built and ran

PDF, A4, one page · energyRt 0.91.5.9015 (dev) · 2026-11-29
What it is

The discounted cost of a process over its years, divided by its discounted output:

LCOE = Σ_y df_y (EAC_y + FOM_y + VOM_y + Fuel_y)
       -----------------------------------------
           Σ_y df_y · Output_y

EAC annualised investment, FOM/VOM fixed and variable O&M, Fuel inputs at their price, df the discount factor. A storage adds its charging cost; a trade divides by what arrives.

ex-ante technology, storage, trade a mini-model around the object: unit demand, the prices you give
model, repository the same, with the container's supplies, calendar, region, horizon and discount
ex-post solved scenario what the process cost and produced in the solution
In its model, before solving
lc <- levcost(mod, name = "ECOA")
lc$levcost_npv
      ECOA 
0.05263046 
Levelized cost of the coal plant by year, split into annualised investment, fixed O&M and fuel

Calendar, region, years, discount rate and the supplies of its inputs come from the model.

Every vintage
lv <- levcost(mod, name = "EWIN",
              by_variant = TRUE)
Each vintage or cluster priced in its own region, so they cannot compete.
Levelized cost of each wind vintage, split into investment and fixed O&M

levcost(lv, by_variant = "npv") or "components" returns the table without solving again.

The function
levcost(object, comm, name, ...)
comm: the output to divide by (default: all of the output group); name: the process in a container.
lg <- levcost(EGAS, fuel_costs = c(GAS = 8),
              discount = 0.07)
lg$levcost_npv
      EGAS 
0.06078848 
One object, no container: inputs priced by fuel_costs.
Options (ex-ante)
fuel_costs prices of inputs (and aux inputs) with no supply
repo supplies, commodities, weather to build with
autocomplete supply missing inputs instead of returning NULL
weather required when the process has a @weather slot
discount, base_year, horizon 0.05; years from olife if none
timeframe "ANNUAL": one slice, the weather as an annual factor; "native": the calendar's slices
by_region one price per region, as a list
method "analytic" closed form, "solve" a mini-model; "auto" picks
frontier extra solves mapping a grouped output's share corners
backstop a costly slack so the mini-model always solves; not in the cost
After solving
sapply(c("ENUC", "EBIO", "EHYD"),
  function(p) unname(levcost(CO2CAP,
    name = p)$levcost_npv))
      ENUC       EBIO       EHYD 
0.02366629 0.04450633 0.02834199 
What each plant cost per unit it produced under the CO2 cap.
ls <- levcost(CO2CAP, name = "STG_ELC")
sapply(ls, \(x) unname(x$levcost_npv))
STG_ELC_VIN2025 STG_ELC_VIN2035 
     0.04619618      0.02962019 
…
A storage: one result per vintage, its charging electricity priced in.

Ex-post: idle capacity raises it, a high load factor lowers it; ex-ante assumes the plant runs as its availability allows.

What comes back
$levcost by year
$levcost_npv one number: the discounted average
$cost_breakdown eac, fixom, varom, input, import, export by year
$cost_breakdown_npv the same, discounted
$cost_yearly undiscounted costs, output, inputs
$frontier the share corners (frontier = TRUE)
$scenario the solved mini-model (solver path)
$units the cost and activity units

autoplot(lc): by year; autoplot(lc, type = "npv"): one bar. A list of results plots side by side.

Grouped inputs and outputs
The feasible biomass share of the fuel group, from 0 to 30 percent
ECHP <- newTechnology("ECHP",
  input = data.frame(comm = c("COA", "BIO"),
                     group = "fuel"),
  output = data.frame(comm = "ELC"),
  group = data.frame(group = "fuel"),
  ceff = data.frame(comm = c("COA", "BIO"),
    cinp2use = c(0.40, 0.35),
    grp.share.up = c(1, 0.3)))
gg_share_frontier(tech_share_frontier(ECHP))[[1]]
Biomass may cover up to 30% of the fuel group: the red segment is the feasible mix the cost is taken along.
tech_share_frontier(object)
The share polytope of each group, as a table.
Caches, reports
set_levcost_cache_path(path)
Where mini-model results are kept and reused.
clear_levcost_cache(x)
Drop them, for one object or all.
report(ECOA, levcost = lc)
The technology report with this cost in it (Reports).
Pitfalls
  • Ex-ante and ex-post answer different questions: what a plant would cost if run as assumed, and what it did cost in this system.
  • Capacity bounds are stripped from the mini-model: it sizes the plant to the unit demand.
  • A weather-driven plant needs its weather, or its availability is whatever af says.
  • A multi-region process is priced in its first region unless by_region = TRUE.
  • The units are the model's: cost unit per activity unit ($units).