energyRt

Making Energy Systems Modeling as simple as a linear regression in R.
https://github.com/optimal2050/energyRt

Category: Energy Systems
Sub Category: Energy System Modeling Frameworks

Keywords

energy-models gams glpk julia pyomo

Last synced: about 22 hours ago
JSON representation

Repository metadata

Making Energy Systems Modeling as simple as a linear regression in R

README.md

energyRt

Lifecycle: maturing
License: AGPL v3

📣 Energy System Modeling with R — a post-conference online series following useR! 2026 · four live sessions, Fridays 7–28 Aug 2026, 12:00 UTC. Details & registration »

energyRt (energy system modeling R-toolbox /ˈɛnərdʒi ɑrt/) is a
macro-language for energy system modeling in R. You describe an energy system —
its fuels, technologies, resources and demands — as R objects; energyRt
compiles them into a full capacity-expansion & dispatch optimization model,
solves it, and returns tidy results ready for dplyr/ggplot2 analysis. The
technical layer (sets, equations, solver files, results parsing) is generated
for you, so you concentrate on the system you are modeling, not on the code
that optimizes it.

One model, four backends

The energyRt optimization model (~100 predefined equations, extendable with
newConstraint()) is implemented in four mathematical-programming languages.
The same model object solves on any of them, with consistent results:

Backend Language License
GLPK / MathProg (bundled with Rtools on Windows) open source
Julia / JuMP Julia + HiGHS open source
Python / Pyomo Python + CBC/HiGHS open source
GAMS GAMS commercial

Start on zero-setup GLPK; switch backends later without touching your model.

Quickstart

A complete model — one fuel, one power plant, one demand — built, solved and
read in ~20 lines (GLPK, no external setup needed on Windows with Rtools):

library(energyRt)

GAS <- newCommodity("GAS", timeframe = "ANNUAL")
ELC <- newCommodity("ELC", timeframe = "ANNUAL")

SUP_GAS <- newSupply("SUP_GAS", commodity = "GAS",
                     availability = data.frame(cost = 6.0))   # fuel price, MEUR/PJ

EGAS <- newTechnology("EGAS",
  input   = list(comm = "GAS"), output = list(comm = "ELC"),
  ceff    = data.frame(comm = "GAS", cinp2use = 0.55),        # 55% efficient
  invcost = list(invcost = 900),                              # MEUR/GW
  fixom   = 25, cap2act = 31.536, olife = 25L)

DEM_ELC <- newDemand("DEM_ELC", commodity = "ELC",
                     dem = data.frame(dem = 50))               # 50 PJ a year

mod <- newModel("HELLO",
  data    = newRepository("parts", GAS, ELC, SUP_GAS, EGAS, DEM_ELC),
  region  = "R1", discount = 0.05,
  horizon = newHorizon(period = 2025:2040, intervals = c(1, 5, 10),
                       mid_is_end = TRUE))

scen <- solve_scenario(interpolate_model(mod, name = "BASE"),
                       solver = solver_options$glpk)

getData(scen, "vObjective", merge = TRUE)   # total discounted system cost
getData(scen, "vTechCap",   merge = TRUE)   # capacity the model built, GW

The Get started vignette walks
through this example and the ideas behind it.

What's in the box

  • Model bricks — commodities, technologies (with efficiencies, fuel blends
    & shares, auxiliary flows like emissions or cooling water), supply, demand,
    storage, weather, trade; draw() sketches any technology as a diagram.
    Model bricks
  • UTOPIA teaching model — a complete multi-region electricity model built
    step by step, shipped as the utopia_modules data kit with ready scenario
    levers (CO₂ cap, carbon tax, renewable share, nuclear moratorium).
    UTOPIA I: building the model
    · UTOPIA II: running scenarios
  • Levelized costlevcost() prices a technology a-priori (screening,
    textbook LCOE) or ex-post from a solved scenario, with autoplot() cost
    breakdowns.
  • Reportsreport() renders an HTML/PDF datasheet for a technology or a
    solved process, levcost included.
  • Scenario workflow — tidy result extraction with getData(), scenario
    editing & re-solving, Arrow-backed save_scenario()/load_scenario() for
    larger-than-memory results.
    Workflow
    · Plotting

Learn more

  • Get started — the core idea in
    ten minutes.
  • Tutorials — installation, solver backends,
    model bricks, UTOPIA, workflow, plotting.
  • useR! workshop — a hands-on training course built on energyRt and the
    UTOPIA model (Quarto book, in preparation).
  • IDEEA — an open multi-region model of
    India's power system, built with energyRt: a production-scale application.

Installation

pak::pkg_install("optimal2050/energyRt")
# or
remotes::install_github("optimal2050/energyRt")

To reproduce pre-2026 models, install the frozen legacy release instead:
pak::pkg_install("optimal2050/energyRt@v0.50").

You will need at least one solver backend. On Windows, GLPK ships with
Rtools
— no extra setup. For Julia/JuMP, Python/Pyomo, or GAMS see the
installation article and the
solver backends article.

Development status

The current development line (v0.60.x) modernizes the interpolation
pipeline, scenario storage, and analysis tools (levcost, report,
autoplot) on the way to v1.0. The v0.50 release ("half-way-there")
is frozen and remains available for pre-2026 modeling projects; its model
code, classes and methods will receive fixes only.

The package website: https://energyrt.org


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 6 days ago

Total Commits: 1,337
Total Committers: 7
Avg Commits per committer: 191.0
Development Distribution Score (DDS): 0.275

Commits in past year: 10
Committers in past year: 1
Avg Commits per committer in past year: 10.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
vpotashnikov p****u@g****m 969
olugovoy o****y@g****m 329
“olugovoy” “****y@g****” 22
ideea-model o****y@e****g 8
energyRt 5****t 7
Michaja Pehl p****l@p****e 1
VZhikhareva v****a@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 14 days ago

Total issues: 6
Total pull requests: 42
Average time to close issues: over 1 year
Average time to close pull requests: 6 days
Total issue authors: 5
Total pull request authors: 4
Average comments per issue: 0.83
Average comments per pull request: 0.19
Merged pull request: 40
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 3
Past year average time to close issues: N/A
Past year average time to close pull requests: less than a minute
Past year issue authors: 0
Past year pull request authors: 2
Past year average comments per issue: 0
Past year average comments per pull request: 0.0
Past year merged pull request: 3
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/optimal2050/energyRt

Top Issue Authors

  • olugovoy (2)
  • BjoernLaemmerzahl (1)
  • AboodaA (1)
  • awanyulianto (1)
  • infsum (1)

Top Pull Request Authors

  • olugovoy (29)
  • optimal2050 (7)
  • vpotashnikov (5)
  • michaja (1)

Top Issue Labels

Top Pull Request Labels


Dependencies

DESCRIPTION cran
  • R >= 3.6 depends
  • parallel * depends
  • DBI * imports
  • RSQLite * imports
  • data.table * imports
  • rpivotTable * imports
  • tidyverse * imports
  • knitr * suggests
  • rmarkdown * suggests
  • sp * suggests

Score: 5.204006687076795