Package: openTEPES
Open Generation, Storage, and Transmission Operation and Expansion Planning Model with RES and ESS (openTEPES)Simplicity and Transparency in Power Systems PlanningTheopenTEPESmodel has been developed at theInstituto de Investigación Tecnológica (IIT)of theUniversidad Pontificia Comillas.TheopenTEPESmodel presents a decision support system for defining the integrated generation, storage, and transmission resource planning (IRP, GEP+SEP+TEP) of alarge-scale electric systemat a tactical level (i.e., time horizons of 10-20 years),
defined as a set ofgeneration, storage, and electric and hydrogen networks dynamic investment decisions for multiple future years.It is integrated in theopen energy system modelling platformhelping modelling Europe’s energy system.It has been used by theMinistry for the Ecological Transition and the Demographic Challenge (MITECO)to analyze the electricity sector in the latest SpanishNational Energy and Climate Plan (NECP) 2023-2030in June 2023.ReferenceA. Ramos, E. Quispe, S. Lumbreras“OpenTEPES: Open-source Transmission and Generation Expansion Planning”SoftwareX 18: June 202210.1016/j.softx.2022.101070.DescriptionopenTEPESdetermines the investment plans of new facilities (generators, ESS, and lines)
for supplying the forecasted demand at minimum cost. Tactical planning is concerned with time horizons of 10-20 years. Its objective is to evaluate the future generation, storage, and network needs.
The main results are the guidelines for the future structure of the generation, storage, and transmission systems.TheopenTEPESmodel presents a decision support system for defining the integrated generation, storage, and transmission expansion plan of a large-scale electric system at a tactical level,
defined as a set of generation, storage, and network investment decisions for future years. The expansion candidate, generators, ESS and lines, are pre-defined by the user, so the model determines
the optimal decisions among those specified by the user.It determines automatically optimal expansion plans that satisfy simultaneously several attributes. Its main characteristics are:Dynamic (perfect foresight): the scope of the model corresponds to several periods (years) at a long-term horizon, 2030, 2035 and 2040 for example.It represents hierarchically the different time scopes to take decisions in an electric system:Load level: one hour, e.g., 01-01 00:00:00+01:00 to 12-30 23:00:00+01:00The time division allows a user-defined flexible representation of the periods for evaluating the system operation. Moreover, it can be run with chronological periods of several consecutive hours (bi-hourly, tri-hourly resolution) to decrease the computational burden without losing accuracy. The model can be run with a single period (year) or with several periods (years) to allow the analysis of the system evolution. The time definition allows also to specify disconnected representative periods (e.g., days, weeks) to evaluate the system operation.
The model can be run with a single period (year) or with several periods (years) to allow the analysis of the system evolution. The time definition can also specify disconnected representative periods (e.g., days, weeks) to evaluate the system operation.
The period (year) must be represented by 8736 hours because several model concepts representing the system operation are based on weeks (168 hours) or months (made of 4 weeks, 672 hours).Stochastic: several stochastic parameters that can influence the optimal generation, storage, and transmission expansion decisions are considered. The model considers stochastic
medium-term yearly uncertainties (scenarios) related to the system operation. These operation scenarios are associated with renewable energy sources, energy inflows and outflows, natural water inflows, operating reserves, inertia, and electricity, hydrogen, and heat demand.The objective function incorporates the two main quantifiable costs:generation, storage, and transmission investment cost (CAPEX)andexpected variable operation costs (including generation, consumption, emission, and reliability costs) (system OPEX).The model formulates atwo-stage stochastic optimizationproblem, including generation, storage, and electric, hydrogen, and heat network binary investment/retirement decisions, generation operation decisions (commitment, startup, and shutdown decisions are also binary), and electric line-switching decisions.
The capacity expansion considers adequacy system reserve margin and minimum and maximum energy constraints.The very detailed operation model is an electricnetwork-constrained unit commitment (NCUC)based on atight and compactformulation, includingoperating reserveswith aDC power flow (DCPF), including electricline switchingdecisions.Electric network ohmic lossesare considered proportional to the electric line flow. It considers differentenergy storage systems (ESS), e.g., pumped-hydro storage,
battery, demand response, electric vehicles, solar thermal, alkaline water electrolyzer, etc. It allows analyzing the trade-off between the investment in generation/transmission/pipeline and the investment and/or use of storage capacity.The model allows also a representation of thehydro systembased on volume and water inflow data considering the water stream topology (hydro cascade basins). If they are not available it runs with an energy-based representation of the hydro system.Also, it includes a representation ofPower to Hydrogen (P2H2)by setting thehydrogen demandsatisfied by the production of hydrogen with electrolyzers (consume electricity to produce hydrogen) and ahydrogen networkto distribute it.
Besides, it includes a representation ofPower to Heat (P2H)by setting theheat demandsatisfied by the production of heat with heat pumps (consume electricity to produce heat) and aheat networkto distribute it. If they are not available it runs with just the other energy carriers.The main results of the model can be structured in these topics:Investment: (generation, storage, hydro reservoirs, electric lines, hydrogen pipelines, and heat pipes) investment decisions and costOperation: unit commitment, startup, and shutdown of non-renewable units, unit output and aggregation by technologies (thermal, storage hydro, pumped-hydro storage, RES), RES curtailment, electric line, hydrogen pipeline, and heat pipe flows, line ohmic losses, node voltage angles, upward and downward operating reserves, ESS inventory levels, hydro reservoir volumes, power, hydrogen, and heat not servedEmissions: CO2 emissions by unitMarginal: Locational Short-Run Marginal Costs (LSRMC), stored energy value, water volume valueEconomic: operation, emission, and reliability costs and revenues from operation and operating reservesFlexibility: flexibility provided by demand, by the different generation and consumption technologies, and by power not servedResults are shown in csv files and graphical plots.A careful implementation has been done to avoid numerical problems by scaling parameters, variables and equations of the optimization problem allowing the model to be used for large-scale cases, e.g., the European system with hourly detail.InstallationThere 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 (version 3.8 | 3.9recommended, 2.7 is supported as well) installation, you can also download the required packages by yourself.Miniconda (recommended)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 typingconda installpython=<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 terminal in any IDE)TheCBC solveris our recommendation if you want a free and open-source solver. For Windows users, download the binaries from thisCBC’s releases, copy and paste thecbc.exefile to the Python folder of the Anaconda or Miniconda environment. In linux it can be installed using:conda install-cconda-forgecoincbc.Install openTEPES via pip bypip install openTEPESContinue atGet Startedand see theTips.GitHub Repository (the hard way)Clone the openTEPES repositoryLaunch the Anaconda prompt (or terminal in any IDE)Set up the PATH bycd"C:\Users\<username>\...\openTEPES". (Note that the path is where the repository was cloned.)Install openTEPES via pip bypip install openTEPESSolversGLPKAs an easy option for installation, we have the free and open-sourceGLPK solver. However, it takes too much time for large-scale problems. It can be installed using:conda install-cconda-forgeglpk.CBCTheCBC solveris our recommendation if you want a free and open-source solver. For Windows users, the way to install the CBC solver is downloading the binaries from thislink of the CBC solver, copy and paste thecbc.exefile to the Python folder of the Anaconda or Miniconda environment. In linux it can be installed using:conda install-cconda-forgecoincbc.GurobiAnother recommendation is the use ofGurobi solver. However, it is commercial solver but most powerful than GLPK and CBC for large-scale problems.
As a commercial solver it needs a license that is free of charge for academic usage by signing up inGurobi webpage.
It can be installed using:conda install-cgurobi gurobiand then ask for an academic or commercial license. Activate the license in your computer using thegrbgetkeycommand (you need to be in the university domain if you are installing an academic license).MosekAnother alternative is theMosek 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 SDPs problems. You only need to useconda install-cmosek mosekfor installation and request a license (academic or commercial).
To request the academic one, you can requesthere. Moreover, Mosek brings alicense guide. But if you are request an academic license, you will receive the license by email, and you only need to locate it in the following pathC:\Users\(youruser)\mosekin your computer.HiGHSTheHiGHS solvercan also be used. For Windows users, the way to install the HiGHS solver is downloading the binaries from thislink of the HiGHS solver, copy and paste thehighs.exefile to the Python folder of the Anaconda or Miniconda environment.
This solver is activated by calling the openTEPES model with the solver name ‘appsi_highs’.GAMSThe model openTEPES can also be solved withGAMSand a validGAMS licensefor 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 startedDevelopersBy cloning the openTEPES from thissite of therepository, you can create branches and propose pull-request. Any help will be very appreciated.Continue like the users for a simple way of executions.UsersIf you are not planning on developing, please follows the instructions of theInstallation.Once installation is complete,openTEPEScan 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 callpython3instead ofpython.):openTEPES_MainThen, four 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 the9norsSEPcase to create a new case of your choice but using the current format of the CSV files.
A proper execution byopenTEPES_Maincan be made by introducing the new case and the directory of your choice. Note that the solver iscbcby default, but it can be changed by other solvers that pyomo supports (e.g., gurobi, highs, mosek).Then, theresultsshould be written in the folder who is called with the case name. The results contain plots and summary spreadsheets for multiple optimised energy scenarios, periods and load levels as well as the investment decisions.Note thatthere is an alternative way to run the model by creating a new scriptscript.py, and write the following:from openTEPES.openTEPES import openTEPES_runopenTEPES_run(<case>,<dir>, <solver>, <result>, <log>)TipsA complete documentation of the openTEPES model can be found athttps://opentepes.readthedocs.io/en/latest/index.html, which presents the mathematical formulation, input data and output results.Try modifying theTimeStepinoT_Data_Parameter_<case>.csvand see their effect on results.Using0or1, the optimization options can be activated or deactivated inoT_Data_Option_<case>.csv.If you need a nice python editor, think about usingPyCharm. It has many features including project management, etc.We also suggest the use ofGurobi(for Academics and Researchers) as a solver to deal with MIP and LP problems instead of GLPK.Run the TutorialIt can be run in Binder:Expected Results