Download & Installation

The openTEPES model has been tested using the latest versions of Python 3.13.7 and Pyomo 6.10.1, and it uses Gurobi 13.0.2 as a commercial MIP solver for which a free academic license is available. It uses Pyomo so that it is independent of the preferred solver. You can alternatively use one of the free solvers HiGHS 1.15.1, SCIP 10.0.2, GLPK 5.0, and CBC 2.10.13. List the serial solver interfaces under Pyomo with this call:

pyomo help -s

Gurobi, HiGHS, SCIP, or GLPK solvers can be installed as a package:

conda install -c gurobi      gurobi
pip   install                highspy
conda install -c conda-forge pyscipopt
conda install                glpk

The openTEPES model can also be solved with GAMS and a valid GAMS license for a solver. The GAMS language is not included in the openTEPES package and must be installed separately. This option is activated by calling the openTEPES model with the solver name ‘gams’.

It also requires the following packages:

  • Pandas for inputting data and outputting results

  • psutil for detecting the number of CPUs

  • Plotly, Altair, Colour for plotting results and drawing the network map

  • NetworkX for representing the DC power flow formulation with cycle constraints

Cases

Here, you have the input files of:

Code

The openTEPES code is provided under the GNU Affero General Public License:

  • the code can’t become part of a closed-source commercial software product

  • any future changes and improvements to the code remain free and open

Source code can be downloaded from GitHub or installed with pip

This model is a work in progress and will be updated accordingly. If you want to subscribe to the openTEPES model updates, send an email to andres.ramos@comillas.edu

Installation

Installation guide.

There are 2 ways to get all required packages under Windows. We recommend using the Python distribution Miniconda. If you don’t want to use it or already have an existing Python installation, you can also download the required packages by yourself.

Miniconda (recommended)

  1. Miniconda. Choose the 64-bit installer if possible.

    1. During the installation procedure, keep both checkboxes “modify the PATH” and “register Python” selected! If only higher Python versions are available, you can switch to a specific Python version by typing conda install python=<version>

    2. Remark: if Anaconda or Miniconda was installed previously, please check that Python is registered in the environment variables.

  2. Packages and Solver:

    1. Launch a new Anaconda prompt (or terminal in any IDE)

    2. HiGHS is our recommendation if you want a free and open-source solver.

    3. Install openTEPES via pip by pip install openTEPES

Continue at Get started.

GitHub Repository (the hard way)

  1. Clone the openTEPES repository

  2. Launch the Anaconda prompt (or terminal in any IDE)

  3. Set up the path by cd "C:\Users\<username>\...\openTEPES". (Note that the path is where the repository was cloned.)

  4. Install openTEPES via pip by pip install .

Solvers

HiGHS

The HiGHS solver can also be used. It can be installed using: pip install highspy.

Gurobi

Another recommendation is the use of Gurobi solver. However, it is a commercial solver but more powerful than open-source solvers for large-scale problems. As a commercial solver, it needs a license that is free of charge for academic usage by signing up in Gurobi webpage. You can also ask for an evaluation license for 30 days to test the solver. It can be installed using: conda install -c gurobi gurobi and then ask for an academic or commercial license. Activate the license on your computer using the grbgetkey command (you need to be in a university internet domain if you are installing an academic license).

GLPK

As an easy option for installation, we have the free and open-source GLPK solver. However, it takes too much time for large-scale problems. It can be installed using: conda install glpk.

CBC

The CBC solver is also another free and open-source solver. For Windows users, the effective way to install the CBC solver is to download the binaries from this site, copy and paste the cbc.exe file to the PATH that is the “bin” directory of the Anaconda or Miniconda environment. Under Linux, it can be installed using: conda install -c conda-forge coincbc.

Mosek

Another alternative is the Mosek solver. Note that it is a commercial solver, and you need a license for it. Mosek is a good alternative to deal with QPs, SOCPs, and SDP problems. You only need to use conda install -c mosek mosek for installation and request a license (academic or commercial). To request the academic one, you can request here. Mosek also provides a license guide. If you request an academic license, you will receive it by email and only need to place it in the path C:\Users\<username>\mosek on your computer.

GAMS

The openTEPES model can also be solved with GAMS and a valid GAMS license for a solver. The GAMS language is not included in the openTEPES package and must be installed separately. This option is activated by calling the openTEPES model with the solver name ‘gams’.

Get started

Developers

By cloning the openTEPES repository, you can create branches and propose pull requests. Any help will be greatly appreciated.

Users

If you are not planning on developing, please follow the instructions in Installation.

Once installation is complete, openTEPES can be executed in a test mode by using a command prompt. In the directory of your choice, open and execute the openTEPES_run.py script by using the following on the command prompt (Windows) or Terminal (Linux). (Depending on what your standard Python version is, you might need to call python3 instead of python.):

openTEPES_Main

Then, five parameters (case, dir, solver, results, and console log) will be asked for.

Remark: at this step, only press enter for each input and openTEPES will be executed with the default parameters.

After this in a directory of your choice, make a copy of the 9n or sSEP case to create a new case of your choice but using the current format of the CSV files. A proper execution by openTEPES_Main can be made by introducing the new case and the directory of your choice. Note that the solver is glpk by default, but it can be changed to other solvers that Pyomo supports (e.g., gurobi, highs).

Then, the results are written to the folder named after the case. The results contain plots and summary spreadsheets for multiple optimized energy scenarios, periods, and load levels, as well as the investment decisions.

Note that there is an alternative way to run the model by creating a new script script.py, and write the following:

from openTEPES.openTEPES import openTEPES_run

openTEPES_run(<dir>, <case>, <solver>, <results>, <log>)

A case can be a CSV directory or a single .duckdb file (see Electric System Input Data). To run many related cases at once — scenario ensembles or sensitivity sweeps — see Multiple runs.

Run the Tutorial

It can be run in Binder:

_images/binder.png