abstract type Iterable

Sometimes, it may be desirable to run E4ST back-to-back with very similar sets of inputs, changing small things in the inputs between runs. In order to do that, we have this custom interface!

The Iterable represents how run_e4st should iterate through multiple optimizations. This structure could be used for any number of things, such as:

  • Running a sequence of years
  • Iterating to find the optimal price for natural gas to meet some load criterion.
  • Running the first simulation for capacity/retirement, then run the next sim to find generation with a higher temporal resolution.

Adding an Iterable to config

  • Add the Iterable to the config, in the same way as you would add a Modification to the config file. I.e.:
# Inside config.yml
  type: MyIterType
  myfield: myval


init!(iter, config) -> nothing

Initialize iter with config, making any changes to config as needed.

init!(ret::Retrofit, config, data)

initialize data with the Retrofit by adding any necessary columns to the gen table, etc. Defaults to do nothing.

init!(iter::RunSequential, config)

Sets up a new config[:out_path] by appending iter1 to config[:out_path]

issequential(iter) -> ::Bool

Return whether or not the iterator advances in years. This may be necessary for some Modifications, whether they prepare the config to move forward or not. Default is true.

should_iterate(iter, config, data) -> Bool

Returns whether or not E4ST should iterate.

iterate!(iter::Iterable, config, data)

Make any necessary modifications to the config or data based on iter.

should_reread_data(iter::Iterable) -> ::Bool

Return whether or not the data should be re-read when iterating.

fieldnames_for_yaml(::Type{I}) where {I<:Iterable}

returns the fieldnames in a yaml, used for printing, modified for different types of iterables.


struct RunOnce <: Iterable end

This is the most basic Iterable. It only allows E4ST to run a single time.


struct RunSequential <: Iterable


Runs E4ST sequentially by running years (or sets of years) one after another. Overwrites config[:years], throwing a warning if the first set in iter is different than that in the config.

  • years = ["y2020", "y2025"]: this will run E4ST twice, once for each year
  • years = ["y2020", ["y2025", "y2030"]]: this will run E4ST twice, once for "y2020" and once for ["y2025", "y2030"]