Download & Installation¶
The openTEPES model has been tested using the latest versions of Python 3.14.7 and Pyomo 6.10.1, and it uses Gurobi 13.0.3 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. Alternatively, you can use one of the free solvers HiGHS 1.15.1, SCIP 10.0.2, GLPK 5.0, or CBC 2.10.13. You can list the serial solver interfaces available under Pyomo with this call:
pyomo help -s
The Gurobi, HiGHS, SCIP, and GLPK solvers can bDownload.mde installed as packages:
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 reading input data and writing results
psutil for detecting the number of CPUs
Plotly, Altair, and Colour for plotting results and drawing the network map
NetworkX for representing the DC power flow formulation with cycle constraints
Cases¶
Here are the input files for:
a static small case study of 9 nodes, the minimal electricity example and the recommended starting point for building a new case,
the same 9-node case stored as a DuckDB file rather than as CSV folders, the worked example for the DuckDB input backend. Same inputs, same results, different container. It is the only
.duckdbkept in the repository; generate any other from CSV with the converter inscripts/openTEPES_DuckDB/,the same 9-node case solved with a PTDF network formulation, which uses power transfer distribution factors and total transfer capacities instead of the angle-based DC power flow,
the same 9-node case coupled with a heat network, which adds heat demand and a heat pipe network on top of the electricity system,
the same 9-node case with two electrolyzers, which models them as the documented Electrolyzer (ELZ) unit type: storage with electric energy outflows, so the hydrogen demand is expressed as the electricity they must draw and the hydrogen carrier itself stays off,
the same 9-node case solved with AC power flow, which adds bus voltages, reactive demand and shunt devices, and solves the network exactly instead of by the DC approximation,
the same 9-node case with the hydrogen carrier on, which carries the whole chain as separate units: an electrolyser, a storage cavern, and a hydrogen-fired turbine that draws its fuel from the hydrogen balance, against a hydrogen demand at one node. Use this one to see the hydrogen balance itself, rather than the electricity a producer must draw,
the same 9-node hydrogen case with no hydrogen demand, which keeps those three units and removes the demand, so hydrogen can only be stored and burned back for electricity, and raises every thermal variable cost tenfold,
a dynamic (multiyear) small case study of 9 nodes with 13 representative weeks per year,
another case, a small Spanish system, which also includes a hydrogen network,
the static Reliability Test System Grid Modernization Lab Consortium (RTS-GMLC),
the same RTS-GMLC solved for operation only, with the investment decisions switched off,
the RTS-GMLC solved with AC power flow, a full year, and the same case for operation only, which is the one to start from: a year of AC is expensive to solve,
a dynamic (multiyear) Reliability Test System Grid Modernization Lab Consortium (RTS-GMLC) with 13 representative weeks per year, and
Code¶
The openTEPES code is provided under the GNU Affero General Public License:
the code cannot become part of a closed-source commercial software product
any future changes and improvements to the code remain free and open
The 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 openTEPES model updates, send an email to andres.ramos@comillas.edu.
Installation¶
There are two ways to get all the required packages under Windows. We recommend using the Python distribution Miniconda. If you do not want to use it or already have an existing Python installation, you can also download the required packages on your own.
Miniconda (recommended)
Install Miniconda. Choose the 64-bit installer if possible.
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>.Remark: if Anaconda or Miniconda was installed previously, please check that Python is registered in the environment variables.
Packages and Solver:
Launch a new Anaconda prompt (or a terminal in any IDE)
HiGHS is our recommendation if you want a free and open-source solver.
Install openTEPES via pip by running
pip install openTEPES
Continue at Get started.
GitHub Repository (the hard way)
Clone the openTEPES repository
Launch the Anaconda prompt (or a terminal in any IDE)
Navigate to the repository directory with
cd "C:\Users\<username>\...\openTEPES". (Note that the path is where the repository was cloned.)Install openTEPES via pip by running
pip install .
Solvers
HiGHS
The HiGHS solver can also be used. It can be installed using: pip install highspy.
Gurobi
Another recommendation is to use the Gurobi solver. It is a commercial solver, but it is more powerful than open-source solvers for
large-scale problems. As a commercial solver, it requires a license, which is free of charge for academic use and can be obtained by signing up on the Gurobi
website. You can also ask for a 30-day evaluation
license to test the solver. It can be installed using conda install -c gurobi gurobi, and
then you can request 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
An easy option to install is the free and open-source GLPK solver. However, it can be very slow for large-scale problems.
It can be installed using: conda install glpk.
CBC
The CBC solver is another free and open-source solver. For Windows users, the easiest way to install the CBC solver is to
download the binaries from this site and copy the cbc.exe file into the “bin” directory of the Anaconda or
Miniconda environment, which is on the PATH. 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 for dealing with QP, SOCP, and SDP problems. You only need to run conda install -c mosek mosek for installation and then request a license
(academic or commercial). You can apply for an academic license 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 test mode from a command prompt. In the directory of your choice, run the openTEPES_Main command
by typing the following in the command prompt (Windows) or terminal (Linux); depending on your default Python version, you might need to call python3 instead
of python:
openTEPES_Main
You will then be asked for five parameters (case, dir, solver, results, and console log).
Remark: at this step, just 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, keeping the current
format of the CSV files. You can then run openTEPES_Main properly by entering the new case and the directory of your choice. Note that the solver is glpk
by default, but it can be changed to any other solver 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: create 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
The tutorial can be run in Binder: