Iterable

E4ST.IterableType
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
iter:
  type: MyIterType
  myfield: myval

Interfaces

source
E4ST.init!Function
init!(iter, config) -> nothing

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

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

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

source
init!(iter::RunSequential, config)

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

source
E4ST.issequentialFunction
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.

source
E4ST.iterate!Function
iterate!(iter::Iterable, config, data)

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

source
E4ST.should_reread_dataFunction
should_reread_data(iter::Iterable) -> ::Bool

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

source
E4ST.fieldnames_for_yamlMethod
fieldnames_for_yaml(::Type{I}) where {I<:Iterable}

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

source

RunOnce

E4ST.RunOnceType
struct RunOnce <: Iterable end

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

source

RunSequential

E4ST.RunSequentialType
struct RunSequential <: Iterable

RunSequential(;years)

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"]
source