Open Sustainable Technology

A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Browse accepted projects | Review proposed projects | Propose new project | Open Issues


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

energy-models gams glpk julia pyomo

Last synced: about 11 hours ago
JSON representation

Repository metadata

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



## energyRt: energy systems modeling toolbox in R

[**documentation in progress.**](

## Installing the package:
stable version (for models built before Aug-2023):

development (not consistent with the 'stable', current models):
`remotes::install_github("energyRt/energyRt", ref = "dev")`

> **⚠️ Warning**
*`energyRt`* is currently in preparation for its first release and publication on CRAN. Names, behavior, meaning of functions, methods, and parameters are being reviewed and may be changed in order to improve the readability and transparency of the code, consistency with other libraries, functionality and features of the final product. Thanks for testing and for your patience. Please report bugs, issues or suggest improvements here:

**energyRt** is a package for [R]( to develop Reference Energy System (RES) models (also known as Capacity Expansion Models (CEM), or "Bottom-Up" technological energy models), and analyze energy-technologies.

**energyRt** package provides tools to formulate the main "bricks" of an energy system model in **R**, and solve the model with one of the mainstream mathematical programming languages:\
\* [GAMS](,\
\* [GLPK/Mathprog](,\
\* [Python/Pyomo](,\
\* [Julia/JuMP](

The RES/CEM model has similarities with [TIMES/MARKAL](, [OSeMOSYS](, but has its own specifics, f.i. definition of technologies.

**energyRt** package is a set of *classes*, *methods*, and *functions* in [R]( which are designed to:\
- handle data, assist in defining RES models,\
- helps to analyze data, check for errors and bugs before parsing it into solver,\
- parses your dataset to GAMS or GLPK or Python/Pyomo or Julia/JuMP and runs them to solve the model,\
- reads the solution and imports results back to R,\
- assists with an analysis of results and reporting.

### Motivation

- minimize time of development and application of RES/BottomUp models,
- boost learning curve in energy modeling,
- improve transparency and understanding of energy models,
- use power of open-source to improve energy models and their application,
- making reproducible research (see [Reproducible Research with R and R Studio] () by @christophergandrud and/or [Dynamic Documents with R and knitr] () by @yihui) accessible in RES-modeling,
- integration with other models and software.

### Development status

The current functionality allows development of multi-regional RES models from basic to well advanced level of complexity, including multiple regions, exogenous or endogenous interregional trade routes (for example, electricity grid), multilevel/nested time-slices, as well as flexible definition of technologies, storages. The package documentation is in development. By now, the best way to test the functionality of the package is to check fully functional examples of the model (see *Examples* bellow).

## Installation

### Prerequisites

#### R and RStudio

Assuming that R is already installed (if not, please download and install from ), we also recommend RStudio (), a powerful IDE (Integrated Development Environment) for R. It simplifies usage of R, provides number of features such as reproducible research (integration with Markdown, Sweave), integration with version control (github, svn).

#### GAMS or GLPK or Python or Julia to solve the model

The cost-minimising linear programming model (the set of equation for LP problem), emboddied into *energyRt* package requires additional software to solve it. Currently *energyRt* model code is written in several languages *GAMS*, *GLPK*, *Python/Pyomo*, *Julia/Jump*. At least one of them is required to solve the model.

The General Algebraic Modeling System (*GAMS*, ) is a powerful proprietary modeling system. Suitable LP solvers: CBC (included in the basic GAMS version, very powerful open source solver) or CPLEX. Others LP solvers have not been tested, but may work as well.

GAMS path should be also added to the environmental variables in your operating system.

*GLPK* is an open source Linear Programming Kit which includes powerful LP and MIP solver, and basic language for creating mathematical programming models (Mathprog or GMPL -- for details see )

GLPK/GMPL is an open source alternative to GAMS, but only for LP and MIP problems. GLPK/GMPL is a bit slower than GAMS for small models, and significantly slower for large models, partially because of the slower Mathprog (GMPL) language processor.

##### Installing GLPK on PC/Windows systems

Download GLPK binaries for Windows: Follow the installation instructions, and add the path to the Windows environment variables.

##### Installing GLPK on Mac systems

You can install GLPK on a Mac using Homebrew or MacPorts:
`brew install glpk`
`sudo port install glpk`

Response from `glpsol` will be an indicator of successful installation.

See: and for details.

##### Installing Pythom/Pyomo

Please folow one of the standard procedures to install Python, make it available in your system's terminal/cmd, install Pyomo package and LP solver(s). CPLEX or Gurobi are recommended for large scale models.

##### Installing Julia/JuMP

Similarly, follow the standard procedure of installing Julia and JuMP package, as well as the solvers and links to the solvers.

*Currently Julia/JuMP version of energyRt is suitable for small-scale models and is recommended for testing only, the code for large-scale models is in progress.*

Owner metadata

GitHub Events

Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 1,246
Total Committers: 7
Avg Commits per committer: 178.0
Development Distribution Score (DDS): 0.222

Commits in past year: 58
Committers in past year: 3
Avg Commits per committer in past year: 19.333
Development Distribution Score (DDS) in past year: 0.207

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

Committer domains:

Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 6
Total pull requests: 32
Average time to close issues: over 1 year
Average time to close pull requests: 8 days
Total issue authors: 5
Total pull request authors: 4
Average comments per issue: 0.5
Average comments per pull request: 0.25
Merged pull request: 30
Bot issues: 0
Bot pull requests: 0

Past year issues: 1
Past year pull requests: 4
Past year average time to close issues: N/A
Past year average time to close pull requests: 1 minute
Past year issue authors: 1
Past year pull request authors: 1
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.25
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 0

More stats:

Top Issue Authors

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

Top Pull Request Authors

  • olugovoy (23)
  • vpotashnikov (5)
  • energyRt (3)
  • michaja (1)

Top Issue Labels

Top Pull Request Labels


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

Score: 4.941642422609304