AnyMOD.jl: Julia Framework for Energy Models
- AnyMOD.jl is a Julia framework for constructing scalable, multi-period energy system models using a novel graph-based representation and JuMP optimization.
- It facilitates customized temporal resolution across carriers, offering flexible CSV-based model creation that balances detail with computational efficiency.
- The framework integrates automated numerical scaling and visualization tools, enhancing rapid model development and robust analysis of energy transitions.
Searching arXiv for the specified paper and closely related references mentioned in the provided data. AnyMOD.jl is a Julia framework for creating large-scale energy system models with multiple periods of capacity expansion, formulated as linear optimization problems using JuMP.jl as a backend (Göke, 2020). It was developed for long-term transition analysis under high shares of intermittent renewable energy and deep sector integration, and it combines model construction from CSV-based inputs with a graphbased approach, automated scaling, integrated visualization, and facilities for streamlining the read-in of input data (Göke, 2020). The package is open-source and available under the MIT License, with an emphasis on both rapid model creation for standard tasks and customizability for advanced applications (Göke, 2020).
1. Scope and defining characteristics
AnyMOD.jl is designed for large-scale, multi-period energy system models, particularly for analyzing long-term transitions in settings with intermittent generation and sectoral integration across carriers such as power, gas, and hydrogen (Göke, 2020). The framework targets a recurring modeling problem: conventional approaches often require a trade-off between detailed temporal representation and tractable long-term capacity expansion analysis. In the description provided for AnyMOD.jl, this problem is framed as a contrast between time series models, which can accurately represent renewables and long-term storage but are typically limited to single years, and time-slice models, which can model many years but at the cost of temporal aggregation (Göke, 2020).
The package’s defining feature is a novel graph-based approach intended to relax that trade-off. Sets such as energy carriers, regions, and time steps are organized as nodes within hierarchical trees, and the level of detail can be varied by energy carrier (Göke, 2020). This permits, for example, hourly resolution for electricity alongside coarser temporal aggregation for other carriers. A plausible implication is that AnyMOD.jl is positioned as an intermediate architecture between purely time-series and purely time-slice formulations, rather than as a strict instance of either category.
The framework also emphasizes operational practicality. Models are specified via CSV files containing core sets and parameters, requiring minimal code for standard tasks, while the resulting optimization model remains accessible through JuMP.jl for extension and manipulation (Göke, 2020). This combination of declarative specification and programmatic extensibility is central to its stated role in research workflows.
2. Graph-based representation of spatiotemporal and sectoral structure
The graph-based modeling approach organizes sets as nodes in hierarchical trees. The provided examples include a temporal hierarchy of the form Year > Day > 4-hours > Hour, a regional hierarchy of the form Continent > Country > Subregion, and carrier hierarchies in which a general energy carrier branches into electricity, gas, hydrogen, synthetic gas, and related categories (Göke, 2020). Technologies are represented through graph edges that map inputs to outputs between carriers, thereby encoding sector coupling, substitution, and storage within a unified system architecture (Göke, 2020).
The central methodological consequence is variable resolution by carrier. Power may be represented hourly to capture fluctuating wind and solar generation, gaseous carriers may be represented daily, and other carriers yearly (Göke, 2020). In the account provided for AnyMOD.jl, this is the mechanism that allows explicit representation of both long-term storage and sector coupling while retaining computational tractability. The paper summary characterizes this as modeling power that exceeds both pure time-slice and pure time-series models, though that formulation should be read as a comparative interpretation rather than a universal ranking (Göke, 2020).
A simplified architecture described in the source material includes wind and solar feeding an electricity grid, electricity feeding an electrolyzer, hydrogen feeding methanation, and synthetic gas emerging as a downstream carrier, with storage and imports represented in the same graph (Göke, 2020). Figure 1 is described as using colored vertices for energy carriers and gray vertices for technologies, with arrows representing mapped flows (Göke, 2020). This visual grammar reflects the underlying modeling ontology: carriers and technologies are treated as distinct structural elements, and their interactions are represented explicitly rather than being implicit in aggregated balance equations alone.
The comparison class given in the source places PyPSA and Calliope among time series models, and MESSAGE, ReEDS, and Switch among long-term evolution or time-slice models (Göke, 2020). In that context, AnyMOD.jl is presented as combining long-term, multi-period modeling with temporal detail for selected carriers. This suggests that its principal contribution lies in heterogeneous resolution across dimensions rather than in a wholly new optimization class.
3. Model specification, CSV interfaces, and the inheritance algorithm
Models in AnyMOD.jl are described through CSV files specifying sets and parameters (Göke, 2020). Sets include time steps at different levels, regions, carriers, technologies, and related categories, with tree mappings used to encode aggregation relationships (Göke, 2020). Parameters such as demand, costs, and efficiency may be provided at arbitrary resolution, for example by year or by hour, by region or globally (Göke, 2020). The framework’s input design is therefore not restricted to a single canonical level of granularity.
The inheritance algorithm is the mechanism that reconciles partial or heterogeneous parameter specification with the model’s full index structure (Göke, 2020). The problem it addresses is described explicitly: specifying every parameter at the highest granularity is unwieldy, but fixed aggregation can erase required detail (Göke, 2020). The illustrative contrast is between a globally specified gas plant efficiency and a heat pump efficiency that is hourly and region-specific (Göke, 2020).
According to the provided description, the inheritance algorithm automatically resolves values not given at the highest detail by inheriting them from parent nodes in the hierarchy, with parameter-specific rules such as sum, average, and direct pass-through (Göke, 2020). The pseudocode representation describes a procedure in which each row is matched directly if possible; otherwise inheritance rules attempt to derive values from relatives up, down, or through aggregation over the tree; and default handling or omission applies if a value remains unassigned (Göke, 2020). The time-step example given is a Year–Day–4-hour block–Hour hierarchy, in which parameters provided only at the Day level are inherited by Hour nodes unless overridden, while balancing rules may sum or average descendant nodes as appropriate (Göke, 2020).
This design has two immediate consequences stated in the source. First, it provides maximum input data flexibility and minimizes redundancy (Göke, 2020). Second, it reduces the burden of model creation and modification because modelers can specify parameters at the aggregation level that best matches data availability or conceptual intent (Göke, 2020). A plausible implication is that this also supports comparative scenario analysis in which only a subset of parameters is altered across runs.
4. Optimization formulation, data structures, and numerical scaling
Created models are formulated as linear optimization problems using JuMP.jl (Göke, 2020). The model equations are automatically generated in JuMP.jl, which is described as a state-of-the-art modeling framework in Julia, and variables and constraints are stored in DataFrames for post-processing and extension (Göke, 2020). An example generation-variable schema is given over indices time-step, region, carrier, and technology, and an example energy balance is written as
(Göke, 2020).
A notable component of AnyMOD.jl is automated two-step scaling of optimization problems (Göke, 2020). The stated motivation is numerical conditioning in LP, especially for interior-point or barrier methods, where poorly scaled matrices can slow or break solution procedures (Göke, 2020). The first step is variable scaling, which identifies variable types with coefficients outside a target range and rescales them, as in the substitution (Göke, 2020). The second step is constraint scaling, which multiplies constraint rows by constants so that all coefficients fall within , described as the recommended range (Göke, 2020).
The paper summary provides an explicit example of the scaling transformation. Before scaling:
After variable substitution:
After constraint scaling:
0
1
(Göke, 2020).
The reported performance outcome is that automatic scaling reduced Gurobi barrier-method solution times by a factor of about three for a test model (Göke, 2020). Within the framework’s overall design, this scaling functionality is therefore not merely cosmetic preprocessing; it is described as a practical device for robust and faster solution of large LP instances.
5. Workflow, computation, and visualization
AnyMOD.jl is intended to support an end-to-end workflow from structured input data to optimization and result reporting (Göke, 2020). The high-level workflow presented in the source consists of initializing a modeling object with input and output directories, creating the JuMP optimization model, setting the objective, assigning a solver, optimizing, and then exporting or plotting results (Göke, 2020). The example uses anyModel("input_folder", "output_folder"), createOptModel!, setObjective!(:costs, model), the Cbc.Optimizer, optimize!, reportResults(:summary, model), and plotEnergyFlow(model, ...) (Göke, 2020).
Several implementation-oriented features accompany this workflow. The framework supports multi-threaded processing for processing-intensive steps where parallelization is possible (Göke, 2020). It also writes results directly to user-specified output folders in user-friendly formats (Göke, 2020). These details indicate that the package is intended not only as a mathematical modeling layer but also as a practical research toolchain.
Integrated visualization is a further component. Internal plotting tools use Python packages including NetworkX and Plotly via PyCall to visualize network topology and energy flows (Göke, 2020). The source specifically mentions graph-based depictions of system architecture and Sankey diagrams for energy flow analysis, covering final uses, storage, and conversions, and supporting both single-year and multi-year results (Göke, 2020). The direct availability of a function such as plotEnergyFlow suggests a close connection between the graph-based internal representation and the post-solution visualization layer.
This coupling of model representation and visualization has analytical significance. Because technologies and carriers are already organized graphically in the model architecture, system topology and flow decomposition can be rendered without a separate ad hoc mapping stage. A plausible implication is that this reduces the gap between optimization output and interpretive diagnostics in multi-carrier studies.
6. Case study, comparative positioning, and prospective extensions
The illustrative case study described for AnyMOD.jl concerns European power and gas sector decarbonization, attributed to Hainsch et al. (2020) (Göke, 2020). The scope is yearly evolution from 2030 to 2040, with Europe subdivided by country and transmission infrastructure aggregated (Göke, 2020). The temporal resolution is heterogeneous by carrier: power is modeled with hourly time steps, gaseous carriers with daily balance, and others yearly (Göke, 2020). Sector coupling includes electrolysis, methanation, hydrogen use, and hydrogen storage (Göke, 2020).
The stated findings from the case study emphasize interpretability rather than a single quantitative conclusion. Sankey diagrams, for example for France in 2040, are said to highlight the role of long-term power-to-gas storage, sector integration, and cross-border flows (Göke, 2020). In the context of the package description, the case study is presented as demonstrating the ability to model complex, geographically extensive, multi-carrier, multi-year transitions at scale, with visual interpretability (Göke, 2020).
The comparative advantages listed in the source are similarly framed. AnyMOD.jl is described as combining the strengths of time-series and time-slice approaches, enabling long-term, multi-period modeling with sector coupling while preserving temporal detail for key carriers (Göke, 2020). It also offers flexible input handling, performance benefits from Julia and automated scaling, openness through CSV and script-based modeling, and extensibility through direct access to the underlying JuMP models (Göke, 2020). The source explicitly notes that no commercial software is necessary, because any compatible open or commercial solver can be used through JuMP.jl (Göke, 2020).
Two future directions are named: finer representation of transmission networks and modeling multiple weather years within a single model, the latter noted as requiring distributed or decomposed optimization algorithms (Göke, 2020). These directions indicate the boundaries recognized in the current formulation. They also suggest that the existing framework is primarily optimized for a particular balance among spatial detail, temporal heterogeneity, and LP tractability rather than for arbitrarily detailed network physics or multi-weather stochastic expansion in a single monolithic model.