Designing a flexible energy system model using multiple dispatch

07/27/2023, 3:30 PM4:00 PM UTC


Energy system models are generally written in algebraic modelling languages like AMPL or GAMS. This both limits the extendibility of the models due to the structure of the languages and can be seen as a threshold due to the license costs for the languages. Julia with JuMP is an excellent alternative as it is both open source and allows for flexibility in model structure by using multiple dispatch. The model is a novel energy system model framework with easy extendibility and high flexibility.


We present, a modular framework for energy systems analyses. A specific goal of the development is to address the challenges of analyzing multi energy-carrier systems with sector coupling, bringing together modelling of technologies that are traditionally modelled separately, with a large span in the need for temporal and geographic resolution, and where accurate models are often non-linear and come with high computational cost. The model is based on existing (proprietary) models and planned to be an open-source framework. It will serve as basis for new extensions in the future and is designed to be modular and flexible to facilitate modelling at different resolutions and technological detail, leveraging Julia’s multiple dispatch.

Time representation - TimeStruct.jl

Representation of time is provided by a first package, TimeStruct.jl, which abstracts the representation of time by providing time-related types and methods, thereby separating the technology description from the time structure. TimeStruct.jl makes it simple to change time resolution and provides types for efficient representation of time series for different time structures, including multi-level structures which are common for optimization models for investment analyses, allowing investments only in a subset of time periods. Iterations over the time periods is achieved through the introduction of iterators and the application of multiple dispatch. TimeStruct.jl also includes the implementation of both operational and strategic uncertainty allowing for the implementation of stochastic problems.

The base package - EnergyModelsBase.jl

The core of the energy model is a base package that provides the fundamental building blocks for energy systems such as production, conversion, and consumption of energy by different processes, implemented using JuMP. The base package focuses on operational models and can be easily extended by other packages to add new functionality (e.g., support for investments/capacity expansion or geography), or to add more precise technology descriptions, e.g., using mixed integer or non-linear production functions or constraints through the application of multiple dispatch on both the model type and the technology nodes. The implementation of improved descriptions does not require any modifications to the base package due the applications of Julia's multiple dispatch. This modularity simplifies future development of, e.g., improved technology descriptions due to the separation between technology and framework descriptions. In addition, it allows for fast development of required technology descriptions.

Example extension - EnergyModelsInvestment.jl

While many larger optimization models in practice only provide users with a limited set of options for investments (e.g., discrete or continuous), InvestmentModels.jl provides types for different classes of investments that can be used in different combinations, e.g., discrete, continuous, or semi-continuous, and provides extra functionality in dependencies between projects (e.g., not allow investing in project A until project B is in operation). The modelling of investment options is separated from the modelling of technology and time structure, allowing easy customization to different use cases. The use of custom types and multiple dispatch also facilitates more efficient model creation, by only generating the necessary (binary) variables for the chosen investment options.

Platinum sponsors


Gold sponsors


Silver sponsors

Pumas AIQuEra Computing Inc.Relational AIJeffrey Sarnoff

Bronze sponsors

Jolin.ioBeacon BiosignalsMIT CSAILBoeing

Academic partners


Local partners


Fiscal Sponsor